Guys i want to apply discount on every 3 product pack, For example if customer bought 3 product from a specific category he will get $5 discount. But if he buy 4 or 5 products from same category then discount should apply on 3 pack. And remaining 2 product price will be same.

And same discount will be applied for multiple of 3 , 6 ,9 , 12, 15 and so on..

Thanks for the help..

  • Magento version? – Greg Feb 19 '18 at 16:20

This post can help you http://excellencemagentoblog.com/blog/2012/01/27/magento-add-fee-discount-order-total/

Here they are adding the extra fees so instead of that you have to decrease the price from grand total.

$address->setGrandTotal($address->getGrandTotal() - $address->getFeeAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getBaseFeeAmount());

Also before that, you have to fetch all the products from current cart.

Check the product category and check their quantity and category type.

Calculate the amount of discount you want to deduct from the grand total.

Best of luck.

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.