Price formula

By using formula in price we can define price based on increase in total Weight/Price/Pretax Price/Quantity/Volume in cart or base on certain logic.

First let see all the variables that you can use in price formula:

tw => total weight of cart
ctwf => condition total weight from in rule condition
ctwt => condition total weight to in rule condition
ctwi => condition total weight increase in rule condition

tp => subtotal of cart
ctpf => condition subtotal from in rule condition
ctpt => condition subtotal to in rule condition
ctpi => condition subtotal increase in rule condition

tptp => pretax subtotal of cart
ctptpf => condition pretax subtotal from in rule condition
ctptpt => condition pretax subtotal to in rule condition
ctptpi => condition pretax subtotal increase in rule condition

tq => total number of items in cart
ctqf => condition number of items from in rule condition
ctqt => condition number of items to in rule condition
ctqi => condition number of items increase in rule condition

tv => total volume of cart
ctvf => condition total volume from in rule condition
ctvt => condition total volume to in rule condition
ctvi => condition total volume increase in rule condition

skip => skip current condition

Let’s understand this by an examples.

Rule is as follows:

Weight from: 20
Weight to: 30
Price: 2*ctwi+5

Now if weight is:

Weight in Cart Increase in Weight
(Weight in cart - Weight from)
Price
20 0 2*0+5 = 5
21 1 2*1+5 = 7
21.5 1.5 2*1.5+5 = 8
22 2 2*2+5 = 9
22.5 2.5 2*2.5+5 = 10
.. .. ..
.. .. ..
29 9 2*9+5 = 23
29.5 9.5 2*9.5+5 = 24
30 10 2*10+5 = 25

You can use Price/Pretax Price/Quantity/Volume if condition value is Price/Pretax Price/Quantity/Volume accordingly.

You can also use below functions in formula:

sin(), cos(), tan(), csc(), sec(), cot(), abs(), log(), log10(), sqrt(), floor() and ceil()

below is an example of formula with above function:

Rule is as follow:

Weight from: 20
Weight to: 30
Price: 2*ceil(ctwi)+5

Now if weight is:

Weight in Cart Increase in Weight
(Weight in cart - Weight from)
Price
20 0 2*ceil(0)+5 = 2*0+5 = 5
21 1 2*ceil(1)+5 = 2*1+5 = 7
21.5 1.5 2*ceil(1.5)+5 = 2*2+5 = 9
22 2 2*ceil(2)+5 = 2*2+5 = 9
22.5 2.5 2*ceil(2.5)+5 = 2*3+5 = 11
.. .. ..
.. .. ..
29 9 2*ceil(9)+5 = 2*9+5 = 23
29.5 9.5 2*ceil(9.5)+5 = 2*10+5 = 25
30 10

2*ceil(10)+5 = 2*10+5 = 25