There is a option to create a automatic discount using API on shopify for amount off order. I want to create a automatic discount for amount off product using graphql
I tried to alter this JSON to apply the discount for products, but it didn’t work. is there any possibility to achieve this?
https://shopify.dev/docs/api/admin-graphql/2024-07/mutations/discountAutomaticBasicCreate
{
"query": "mutation discountAutomaticBasicCreate($automaticBasicDiscount: DiscountAutomaticBasicInput!) { discountAutomaticBasicCreate(automaticBasicDiscount: $automaticBasicDiscount) { automaticDiscountNode { id automaticDiscount { ... on DiscountAutomaticBasic { startsAt endsAt minimumRequirement { ... on DiscountMinimumSubtotal { greaterThanOrEqualToSubtotal { amount currencyCode } } } customerGets { value { ... on DiscountAmount { amount { amount currencyCode } appliesOnEachItem } } items { ... on DiscountSpecificItems { specificItems { id } } } } } } } userErrors { field code message } } }",
"variables": {
"automaticBasicDiscount": {
"title": "$100 off specific products over $500 for all customers",
"startsAt": "2024-01-01T00:00:00Z",
"endsAt": "2024-12-31T23:59:59Z",
"minimumRequirement": {
"subtotal": {
"greaterThanOrEqualToSubtotal": 500
}
},
"customerGets": {
"value": {
"discountAmount": {
"amount": 100,
"appliesOnEachItem": false
}
},
"items": {
"specificItems": [
{ "id": 8885203271935 }
]
}
}
}
}
}
New contributor
Karthick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.