Inconsistent handleization

Short description of issue

A display name for a metaobject entry like TEST_CODE will have the handle test-code but if you handleize the string in Liquid it will have the handle test_code. Similarly with numbers, if you have the display name as TEST1234TEST it will have the default handle of test-1234-test but if you handleize the string in Liquid it would have test1234test.

Reproduction steps

Create a metaobject entry with a display name that has an _ or one with numbers. Attempt to handleize the same display name within Liquid for direct metaobject entry access and you get a different handle that cannot be used.

Additional info

Ideally Shopify will ensure that handleization works the same across the board.

In our case we are including discount codes as metaobject entries to display additional details about them within the cart for our customers because discount code details themselves are somewhat limited and cannot be accessed in Liquid.

We have customers enter the discount code in the cart and then when it applies we are handleizing it to access the associated metaobject entry and display the additional details about it.

One thing to note is that handles can be changed, so some sort of access permissions for controlling whether or not they are editable by certain staff or collaborators would be ideal to have too.

Because of the approach it relies on following an SOP so that the code can handle the 1:1 match for accessing the metaobject entry details.

Simply saying to not use _ or numbers in a discount code is not a solution. Needing to modify handles to make things work is also not a good solution.

What type of topic is this

Feature request

1 Like

I should add, allowing us to add metafields to discount codes and access them directly via Liquid, based on usage (or not) would be ideal.

So being able to use something like discount_codes['TEST_CODE'].metafields.custom.additional_details.value to access some additional information about a discount code would be an additional feature request remotely related to the above request solely because of how we’re using metaobjects and discount codes, because there is not a better way of doing it.

1 Like