Blog posts tagged with 'Discount'

RSS
Shipping Discount - use a negative surcharge- Friday, December 14, 2012

Similar to adding an insurance surchargeto the shipping rate, one can provide a discount just by making the surcharge a negative amount.

In this example, we’ll use the “Shipping by weight” calculator for shipping, and set a discount of $2.99 if the cart’s total is $20 or more.

Order

Type

Name

Expression

Rate Expression

Surcharge Expression

10

Option

Shipping

true

Shipping.ByWeight

([$SubTotalWithDiscounts] > 20) ? -2.99 : 0

As mentioned in prior blogs, the " ? : " is the ternary if-then-else operator.  These can be chained together if needed - for example to have discounts based on amount like this:

Subtotal greater than

Discount

100

7.99

50

5.99

20

2.99


Then the expression would look like

  ([$SubTotalWithDiscounts] > 100) ? -7.99 :  ([$SubTotalWithDiscounts] > 50) ? -5.99 :  ([$SubTotalWithDiscounts] > 20) ? -2.99 : 0

Tags :  Discount
Comments (1)