Discussing Shopify Functions development, deployment, and usage in Shopify apps.
Hello,
I am working on app which implement shopify functions. I create products discount function and all is working fine for me. Now, i try to use variables in input.graphql. I want to offer products discount only to customers with selected tags. Only way i know to do it, is hard coded customers tags in input.graphql (i am sending print screen in attachement). Is there some way i can use dynamic variable with customers tags in input.graphql? For example, can i use customers tags variable from metafield there somehow? If yes, can you plase write me example how to use it in input.graphql and main.rs?
Thank you so much.
Hi @Adam_Čvikota! We don't support this yet, but it's in the roadmap for the near future. We intend to have a mechanism for you to define variable values for the input query.
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
Did you ever get this to work? I want to just load the customer tags here.
Variables are now supported in input queries, details are here:
https://shopify.dev/docs/apps/functions/input-output/variables-queries
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
I am having the same problem.
I found this:
https://shopify.dev/docs/api/functions/reference/order-discounts/graphql/common-objects/customer
Where it returns a simple boolean if one of the list of tags is in the customer tags. Whereas the other returns an object with boolean and the tag's themselves.