How to use variable in input.graphql

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.

1 Like

Hi @Adam_Cvikota ! 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.

Did you ever get this to work? I want to just load the customer tags here.

1 Like

Variables are now supported in input queries, details are here:

https://shopify.dev/docs/apps/functions/input-output/variables-queries

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.