Discussing Shopify Functions development, deployment, and usage in Shopify apps.
In the below code, I want to get all tags or tags starting with a specific string on the customer and/or product.
How can I do it?
Hi @mjzap --
This is not currently possible with Functions, as they require you to request a specific tag for performance reasons. Can you describe more about your use case? You might consider user-configured tags with input query variables, or use of metafields instead.
-Nick
Nick Wesselman | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Hi,
The use case could be an app that manages various types of discounts by applying tags to a product.
Tags contain an identifying prefix (common for all discounts) and a series of information related to the discount (for example the type of discount and the value of the discount), something like "promo:2:value:10" or "promo:20:value:7". Receiving all the tags that start with promo would allow me to have the list of discounts to apply. The same result can be achieved receiving the complete list of tags and filtering all tags with a certain prefix.
Do you have any suggestions for solving this problem using tags?
This looks like a scenario where we would recommend moving to metafields, instead of embedding values into a tag string.
Nick Wesselman | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog