Jump to content

Cart Rules – Minimum to Maximum amount


Recommended Posts

Hi,

 

We'd like to create different sets of discounts based on the total amount of purchase. For e.g., 20% discount for $500-$600 and 30% discount for $600-$800. How is this achievable? The Cart Rules only has the "minimum amount" option when I create a new rule.

 

Regards

Link to comment
Share on other sites

Hi,

 

We'd like to create different sets of discounts based on the total amount of purchase. For e.g., 20% discount for $500-$600 and 30% discount for $600-$800. How is this achievable? The Cart Rules only has the "minimum amount" option when I create a new rule.

 

Regards

 

Hi, Have you tested with both minimum amounts? What are the results?

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...
  • 1 year later...

So this might help people.
I was looking to set a max amount. As standard there is a min amount. So it was a simple change of 1 character.

Go here Home/classes/CartRule.php

Find and change:

            if ($cartTotal < $minimum_amount)
                return (!$display_error) ? false : Tools::displayError('You have not reached the minimum amount required to use this voucher');

to
            if ($cartTotal > $minimum_amount)
                return (!$display_error) ? false : Tools::displayError('You have exceeded the maximum allowable amount to use this voucher');

Im sure also if you want between amount hard coded could be 

            if ($minimum_amount < $cartTotal < 100 )

Link to comment
Share on other sites

  • 10 months later...

i have resolve this problem Go here Home/classes/CartRule.php and than find autoAddToCart function and add this function 

 

if($cartTotal > 350) {
                $context->cart->addCartRule(12);
            }

cart rule add in admin panel and set  addcartrule  id

 

Thanks

akash sen

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...