Shopify Functions Input Variables

The issue is likely due to metafield app ownership. You are using the $app namespace on your metafield, so the metafield value must be set by the same app that contains the function. The GraphiQL app is its own app, so $app will resolve to a different app. Using Postman might work, but you’d need to ensure that the API Key used is from your function app.

In production, better would be to create a UI Extension for your discount, which will set the metafield properly. You could create a configuration UI for the tag that way as well.