Vote up!
Vote down!

Help with Rules: "Buy 2 get 1 free" discount

Here's how I want to do it.

After adding a product to the cart

Line item product has term "B2G1F"

Get total number of items in the cart with term "B2G1F" (ex.: return 5)
Divide total number of items by 2 (ex.: return 2.5)
Get the integer of the previous results using PHP (ex.: return 2)
*Get the 2 lowest priced products in the cart
*Make an addition of price of those 2 products (ex.: $2 + $3 = $5)
*Add discount to the cart for the previous value (ex.: -$5)

I used "Add a variable" action to get the number of items in the cart
I used "Calculate a value" action to divide the number of items by 2
I used "Execute custom PHP code" action to get the integer with int()

All I miss are the last 3 actions of the list. Any idea?

Asked by: evanasse
on May 15, 2013

1 Answer

Vote up!
Vote down!

I need exactly the same thing. I tried it using code but did not succeed.

Answer by: rashidkhan
Posted: May 19, 2013