Multiple automatic discount codes using PriceRules?

loicnestler
New Member
2 0 0

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).

🙂

Replies 2 (2)
sillycube
Shopify Partner
693 16 101

Only 1 discount can be used at a time. Currently, the Shopify discount can handle this quantity break discount. Usually, it's solved by discount app or bundle app

BYOB - Build Your Own Bundles, SPO - SEO App to research keywords & edit social link preview
loicnestler
New Member
2 0 0

@sillycube 

Yeah, that's why I was asking about PricingRules.

I guess bundle apps need some way of solving this issue too – using the same Shopify API as I use, right?

Isn't PricingRules what I need for that?