I want to create an automatic discount where a customer gets a free product on a purchase of $100 or more. I am using the discountAutomaticBxgyCreate
mutation. Here’s an example:
mutation CreateBxgyDiscount($automaticBxgyDiscount: DiscountAutomaticBxgyInput!) {
discountAutomaticBxgyCreate(automaticBxgyDiscount: $automaticBxgyDiscount) {
automaticDiscountNode {
id
automaticDiscount {
... on DiscountAutomaticBxgy {
title
startsAt
}
}
}
userErrors {
field
message
}
}
}
Input variables:
{
"automaticBxgyDiscount": {
"title": "Free Product on $100 Purchase",
"startsAt": "2025-01-01T00:00:00Z",
"customerBuys": {
"items": {
"all": true
},
"value": {
"amount": "100"
}
},
"customerGets": {
"items": {
"products": {
"productVariantsToAdd": [
"gid://shopify/ProductVariant/39960475140163"
]
}
},
"value": {
"discountOnQuantity": {
"quantity": "1",
"effect": {
"percentage": 1
}
}
}
},
"usesPerOrderLimit": "1"
}
}
I receive the below error:
{
"data": {
"discountAutomaticBxgyCreate": {
"automaticDiscountNode": null,
"userErrors": [
{
"field": [
"automaticBxgyDiscount",
"customerBuys",
"items"
],
"message": "Items in 'customer buys' must be defined"
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 11,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 2000.0,
"currentlyAvailable": 1990,
"restoreRate": 100.0
}
}
}
}
Does {all: true}
not work? Is there an alternate way of doing this?
Same question here as well.