I’m trying to build the UI for a product discount extension and store the configuration in a metafield associated with the discount. Whenever I run the mutation
mutation MutateMetafield($discId: ID!, $mfId: ID!, $mfValue: String) {
discountAutomaticAppUpdate(
id: $discId
automaticAppDiscount: {metafields: [{id: $mfId, value: $mfValue}]}
) {
userErrors {
field
message
}
}
}
I get the error “The discount doesn’t exist”, but it works if I run the exact same mutation in the GraphiQL App on the store it works. I’ve double-checked I’ve already got the write_discounts scope added to the shopify.app.toml file and I’m using the official JS client to run the mutation. Where else should I check next? Thanks in advance for any help!