I'd like to create a discount that is applied based on the weight of a cart.

I'm working with bottles & boxes of wine, so a bottle of wine has a weight of 1kg & a box of wine can have a weight of 6kg (6 bottles) or 12kg (12 bottles).

I need the discount to only apply when a customer from a certain customer group purchases 12 or more bottles of wine, but can't work with quantity because a quantity of 1 could be 1 bottle of wine or 1 box of wine (which could contain 6 or 12 bottles), hence my desire to apply the discount by weight of the entire cart instead.

I think the best way to do this would be to set up a rule for the customer group, apply it to all products & set a minimum of 1 to ensure that the rule always runs & then add logic in a plugin that fires on some or other discount event that then checks the weight and applies or doesn't apply the discount.

Something like:

    if( cartWeight >= 12){
       $event->performAction = false;

But I'm having trouble figuring out which event to use & how to put all the pieces together to achieve my desired result.

Any pointers in the right direction would be greatly appreciated.

1 Answer 1


It would probably be best to make your own shipping adjuster. I have attached an example plugin here: http://jmp.sh/wC95ZPj

The adjuster plugin I have linked can look at the weight of the cart, it's line item contents, and then reduce (or add to) the shipping costs after the regular shipping calculations are run.

  • Ok - so not possible to do this with a custom discount adjuster ? Commented Jun 29, 2017 at 5:17
  • Just another way that makes sense to me, and simplifies the whole thing. Let your discounts and shipping costs apply, but reduce the shipping cost with another shipping adjustment. Commented Jun 30, 2017 at 4:09

Your Answer

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

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