0

I have an expresso store that we've set up with a "Buy x get y discount". But it's not working as expected as it only works if you buy multiples of the same product. This is not really useful, it needs to apply to all the products selected for that promo code.

1
  • I have built an extension that does exactly this. Let me know if you need any pointers. Apr 21, 2016 at 8:01

1 Answer 1

1

This is the intended behavior of how that discount type works. If you go to the Discount Settings you will see a field called Matched On with the options of either Entry ID or SKU. This is what Store uses to match the particular product to apply the discounts on. Think of it as buy 2 shovels get 50% off a 3rd shovel. This assumes you have set the Step Quantity at 2, Discount Quantity at 1 and Percent Discount at 50. If a user adds 6 of that item to the cart they will receive a discount on the 3rd and 6th of that item since the Discount Quantity is set to 1.

You will need to develop your own discount type or extend the current discount type for your use case. You can browse through the current discount logic in /store/src/Adjuster/DiscountAdjuster.php to get a starting point. Developing your own extension would probably be the best option as it gives you the most control and prevents Store updates from overwriting your changes. The adjustments hook would probably be the best option for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.