3

Under Commerce > Promotions there are the two options: Sales & Discounts. Sales is a flat rate with little conditions, so that leaves Discounts.

Discounts have a bit more flexibility, but only seem to have a minimum quantity option. So, if I want to make a buy one get one free deal, I can't limit it to the quantity to a maximum of 2, therefore the discount gets applied to the total amount regardless of how many are added.

Has anyone else had any success setting up a BOGOF deal or anything similar?

5

I've used a relatively simple plugin to listen to commerce_cart.onBeforeAddToCartwhich checks what is being added to a cart and if it is a certain item it will automatically add the free item to the cart (or increment the qty if it's already in there).

(Of course you must then also listen to commerce_cart.onRemoveFromCart to remove the free item if the 'parent' item is removed...as I recall this is slightly trickier as you get a copy of the order with the item removed (there's no beforeRemoveFromCart yet) - so you jsut have to loop over the whole cart and look at it holistically).

https://craftcommerce.com/docs/events-reference#commerce_cart.onbeforeaddtocart https://craftcommerce.com/docs/events-reference#commerce_cart.onremovefromcart

(In general a business logic plugin can implement most discount things fairly easily but I am hoping a really nice, flexible GUI driven discounts plugin thingy comes along for Commerce!).

4
  • 1
    Thanks for the answer. I ended up making a plugin using the Adjusters api instead, plugin can be found here for anyone else interested: craftpl.us/plugins/product-deals Dec 8 '16 at 15:53
  • @StephenHamilton Is this plugin available on Github anywhere? As Craft Plus seems to be dead :( RIP.
    – Jason Mayo
    Jun 3 '19 at 8:07
  • @JasonMayo Here you go: github.com/totov/deals Jun 3 '19 at 13:11
  • @StephenHamilton Amazing! Thanks for putting it on Github :)
    – Jason Mayo
    Jun 11 '19 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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