Is it possible to use input graphql variables in a discount function for company metafield key?

I’m trying to use a variable in an input query for a product discount function, following these docs:

I’ve created the metafield using graphql scoped to the app:

In the logs, the function-configuration metafield itself is being pulled in, but the companyMetafield isn’t populating:

I’ve got it defined in shopify.extension.toml:

  [extensions.input.variables]
  namespace = "$app:product-discount"
  key = "function-configuration"

Hi @kalen

Everything looks OK from what you shared. Are you sure that the company in this execution has a metafield with this namespace and value? If you hardcode the key do you get the expected value?

If you look at the execution logs in the Parter Dashboard, do you see the expected variable value there ({ "companyMetafield" : "price"})?

-Nick

2 Likes

Nailed it. :sweat_smile: Thank you sir. First time using these graphql variables in here.

2 Likes