What I know.
What I have seen on my searches till now is that we can add custom discount to the quote and split the discount among the quote Items based on ratio calculated.
What I want.
But I want to give specific discount on some line Items(quote items) , say a Gift Item included with a product. As it's a gift Item, I want to give the line item 100% discount, such that my row total will be zero and subtotal have the grand total will have the subtotal – discount amount.
The same line item added individually will be a regular product with no discount.
The Problem
I'm not able to give discount amount to the quote item with out making issue existing calculation.
How can I achieve such a scenario in Magento 1.x programatically? Any Ideas? I have tried using the sales_quote_collect_totals_after and sales_quote_address_discount_item observers with no luck.
Best Answer
Find the Extension for free product.
You have to do changes for your requirement.
Make changes in
C4B_Freeproduct_Model_Observer
functionsalesruleValidatorProcess
You have to retrieve sku of that product which you want to add into cart as free product (Way you are retrieving in your curent observer) . This function runs for the all products in the cart.
Create one cartrule from admin and select add gift. Add any dummy SKU as we are not using it anywhere.