Hey there!
I am currently working for a client, who wants to have a feature similar to the following:
- Buy 3 get 10% off
- Buy 5 get 15% off
- Buy 10 get 20% off
I already had a deeper look into the Shopify Admin API docs (which are horribly documented by the way) and found out about PriceRules.
I tried out this query
mutation priceRule {
priceRuleCreate(
priceRule: {
validityPeriod: { start: "2021-10-08T13:22:43.972Z" }
title: "TEST_CODE_PRICE_RULE"
value: { percentageValue: -20 }
itemPrerequisites: {}
itemEntitlements: { targetAllLineItems: true }
prerequisiteQuantityRange: { greaterThanOrEqualTo: 3 }
allocationMethod: ACROSS
target: LINE_ITEM
customerSelection: { forAllCustomers: true }
}
) {
priceRule {
id
}
priceRuleDiscountCode {
code
id
}
priceRuleUserErrors {
code
field
message
}
}
}
but it doesn’t do anything, it appears.
Does anybody have a tip on how to solve this problem?
Thanks a lot in regards!
EDIT:
Ideally, the customer shouldn’t be required to enter a discount code (similar to how automatic discounts work).
![]()