I have the following mutation which works:
`#graphql
mutation discountAutomaticAppCreate($automaticAppDiscount: DiscountAutomaticAppInput!) {
discountAutomaticAppCreate(automaticAppDiscount: $automaticAppDiscount) {
userErrors {
field
message
}
automaticAppDiscount {
discountId
title
startsAt
endsAt
status
appDiscountType {
appKey
functionId
}
combinesWith {
orderDiscounts
productDiscounts
shippingDiscounts
}
}
}
}`,
{
variables: {
"automaticAppDiscount": {
"title": title,
"functionId": "sdfgsdfg4345-493e-bb17-b08837ddbe3d",
"startsAt": "2024-02-02T17:09:21Z",
"metafields": [
{
"namespace": title,
"key": "tags",
"type": "json",
"value": "{"value":"42"}"
// "value": "{"discounts":[{"value":{"fixedAmount":{"amount":5}},"targets":n [{"orderSubtotal":{"excludedVariantIds":[]}}]}],"discountApplicationStrategy":"FIRST"}"
}
]
}
},
}
However I need to change this to be a mutation which runs two mutations at once.
Here is my attempt but I get an error with the variable $automaticAppDiscount:
`#graphql
mutation {
discountAutomaticAppCreate: discountAutomaticAppCreate($automaticAppDiscount: DiscountAutomaticAppInput!) {
discountAutomaticAppCreate(automaticAppDiscount: $automaticAppDiscount) {
userErrors {
field
message
}
automaticAppDiscount {
discountId
title
startsAt
endsAt
status
appDiscountType {
appKey
functionId
}
combinesWith {
orderDiscounts
productDiscounts
shippingDiscounts
}
}
}
}
addPost: addPost {
id
title
content
}
}`,
{
variables: {
"automaticAppDiscount": {
"title": title,
"functionId": "142a51d8-f06c-493e-bb17-b08837ddbe3d",
"startsAt": "2024-02-02T17:09:21Z",
"metafields": [
{
"namespace": title,
"key": "tags",
"type": "json",
"value": "{"value":"42"}"
// "value": "{"discounts":[{"value":{"fixedAmount":{"amount":5}},"targets":n [{"orderSubtotal":{"excludedVariantIds":[]}}]}],"discountApplicationStrategy":"FIRST"}"
}
]
}
},
}