Understood.
The issue seems to be that the update mutation doesn’t support upserting a metafield.
What is means?
You can either create a new metafield in the update mutation or update an existing metafield using it’s ID
What should be done?
During the discountAutomaticAppCreate mutation when you’re creating a metafield. Get the ID of the metafield.
During the discountAutomaticAppUpdate mutation, send the ID of the metafield as well in the query.
Alternatively, you can use metafieldsSet mutation to set metafields separately.
Where the ownerId would be discountNode ID.
Ex: gid://shopify/DiscountAutomaticNode/XXX
More about metafieldsSet
