A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I have created a price rule using GraphQL but nothing seems to be happening. I received no errors when I created it but the rule doesn't seem to getting applied.
Basically, when a specific product has more than 9 in the cart then £1.00 should be deducted from each item:
mutation priceRuleCreate($priceRule: PriceRuleInput!, $priceRuleDiscountCode: PriceRuleDiscountCodeInput) {
priceRuleCreate(priceRule: $priceRule, priceRuleDiscountCode: $priceRuleDiscountCode) {
priceRuleUserErrors { field, message, code }
priceRule {
id,
title
}
priceRuleDiscountCode {
id
code
}
}
}
Variables:
{
"priceRule": {
"title": "price rule 1",
"allocationMethod": "EACH",
"customerSelection": {
"forAllCustomers": true
},
"itemEntitlements": {
"targetAllLineItems": false,
"productIds": [
"gid://shopify/Product/6804610678877"
]
},
"prerequisiteQuantityRange": {
"greaterThan": 9
},
"target": "LINE_ITEM",
"validityPeriod": {
"start": "2022-05-26T08:00:00-04:00"
},
"value": {
"fixedAmountValue": "-1.00"
}
}
}