Thursday, December 3, 2015

Magento - Multiple Actions for Single Coupon Code

Hello,

Recently in one of my project we had a requirements to supports multiple actions for single coupon code. For example if my my cart total is between 500 to 1000, the coupon should give flat 50 off discount and if total is more than 1000, coupon should give flat 100 off discount. But coupon code should be same.

We all know that magento only allows unique coupon code and each coupon will have only once action. So how to do this? I have explained it in this blog.  Please note that this solution needs changes in magento database. So only use it if you database very well.

So while looking to solve this issue. I found out that, in magento database there is a unique key defined for coupon code. So to solve this problem we have to remove that unique key.

So open your Magento database and run following SQL command.

ALTER TABLE salesrule_coupon DROP INDEX UNQ_SALESRULE_COUPON_CODE;

This will drop unique key index.

Now go back to magento admin panel and clear the cache and create two different shopping cart rules with different discounts and keep the coupon code same and it will work.

Hope this helps you.




No comments:

Post a Comment