Using set_cart_discount in Zen Cart Big Chooser

The Zen Cart Big Chooser discounting module normally works in “Buy X, Get Y” mode – but you can configure it differently.  If you want to discount the entire package (X+Y) or even the entire basket if X and Y are purchased, you can use “set_cart_discount.”

The easiest way to understand this is with a series of examples. Suppose you have the items in your cart:

5x product 28  @$5: $25
1x product 29 @$10: $10
1x product 30 @$25: $25
-----------------------
Subtotal:           $60

If you used this offer

 $this->add_condition("Buy product 29 and 30, get 10% off your purchase", false); 
     $this->set_constraint(PROD, 29, 1, PROD, 30, 1); 
     $this->set_cart_discount("%", 10); 

the discount would be 10% of $60, or $6.

If you used this offer

 $this->add_condition("Buy product 29 and 30, get 10% off the pair", false); 
     $this->set_constraint(PROD, 29, 1, PROD, 30, 1); 
     $this->set_cart_discount("%", 10, CART_DISCOUNT_CONSTRAINTS_ONLY); 

the discount would be 10% of $35, or $3.50.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.