cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 1.9 Apply to cart programmatically

Magento 1.9 Apply to cart programmatically

Hello everybody,
I have a question for you
I have to set a discount on specific items and based on the quantity of these items in the cart.
only 1 items in the cart, the discount will be 30% on this item
2 items in the cart, the discount will be 40% on these items the items are equal or greater than 4 items, the discount will be 50% on these items https://router-help.com/ip/192-168-10-1
So I think that I can do this only by code, maybe by an observer. By I don't know to modify the discount in the cart (I can loop on the items in the cart and get the price, but i don't know how to modify the discount or the grand total). 192168101.com
Can anyone help me

1 REPLY 1

Re: Magento 1.9 Apply to cart programmatically

I think you can create 3 Cart rules like this :

 

1). if 1 items in the cart, the discount will be 30% on this item. (if total items in cart equals to 1)

2). 2 items in the cart, the discount will be 40% on these items.(if total items in cart equals to 2)

3). the items are equal or greater than 4 items, the discount will be 50% on these items (if total items in cart equals to or greater than 4)

 

You don't need to go in code and only one rule will apply as per the above condition, so no rule with collapse with each other.

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy