Jump to content

Exclude product from ALL Cart Rules


FreshElement

Recommended Posts

We have created a SKU (ID) that contains 3 different products.  Individually, they sell for $352, when purchased as one product using the special SKU, the 3 together cost $280.  If a customer adds this product to their cart we do NOT want it to be included or used with ANY cart rules.

 

For example, we have a cart rule that allows a 15% discount if 3 or more products are purchased at one time.  We do NOT want this rule to apply to this special SKU.  If the customer wants this special product combo (SKU), they can add it to their cart.  If they also want the 15% discount for 3 products or more ordered at the same time, the customer must add 3 more products to the cart AND the 15% discount can NOT apply to the special SKU.

 

I have not been able to find any way of accomplishing this.  I've tried devising a special cart rule for the SKU that does nothing but is NOT COMPATIBLE with other cart rules... it did not work.

 

Please help...

 

Clem

Link to comment
Share on other sites

It's not easy.
You have to modify/override the checkValidity() method of the CartRule class

You can use $context->cart->getProducts(); to loops through products. If any has the name you do not want, you can return an error with 


return (!$display_error) ? false : Tools::displayError('You cannot add this voucher to the XXX product');

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...