I am trying to give an automatic discount to the customer with a particular tag
my run.graphql -
query RunInput($tags: [String!]!) {
cart {
buyerIdentity {
customer {
metafield(namespace: "$app:my-namespace", key: "my-key") {
value
}
hasTags(tags: $tags) {
hasTag
tag
}
}
}
lines {
id
merchandise {
... on ProductVariant {
id
title
}
__typename
}
}
}
}
first I run a graphql-
mutation discountAutomaticAppCreate($automaticAppDiscount: DiscountAutomaticAppInput!) {
discountAutomaticAppCreate(automaticAppDiscount: $automaticAppDiscount) {
userErrors {
field
message
}
automaticAppDiscount {
discountId
title
startsAt
status
appDiscountType {
appKey
functionId
}
}
}
}
variables -
{
"automaticAppDiscount": {
"title": "Take 5$ from discount",
"functionId": "654dd37d-6384-4392-b05d-8e03f9f383d9",
"startsAt": "2024-12-02T00:00:00Z"
}
}
shopify.extension.toml -
[extensions.input.variables]
namespace = "$app:my-namespace"
key = "my-key"
then I run this mutation for metafield to set the variables -
mutation SetMetafield {
metafieldsSet(metafields: [
{
namespace: "$app:my-namespace",
key: "my-key",
ownerId: "gid://shopify/DiscountAutomaticNode/1447703314665",
type: "json",
value: "{\"tags\": [\"trade_program\"]}"
}
]) {
metafields {
id
}
}
}
but the issue comes when I run the above mutation to create metafield in GraphiQL built into ‘shopify app dev’ then it works fine but when I run it in the post man or the GraphiQL app it doesn’t work and gives the error of InvalidVariableValueError, so I am having no issue running it in development store but having issue on live stores because there I can not run GraphiQL built into ‘shopify app dev’