3

Does anyone know if it's possible to use the same Coupon Code for multiple price rules. I want to give 10% off Category A and 7% off Category B, if they have any of the qualifying products in their cart.

Currently Magento throws the "Coupon with the same code already exists." but i read that you can disable this by removing the index and updating a core file, but i'm not sure what changes need to be made to the core file.

I'm referring to this comment: https://magento.stackexchange.com/a/29360/15768

Grateful for any advice here. Thanks.

1 Answer 1

7

Mage_SalesRule_Model_Resource_Coupon

    protected function _construct()
{
    $this->_init('salesrule/coupon', 'coupon_id');
    $this->addUniqueField(array(
        'field' => 'code',
        'title' => Mage::helper('salesrule')->__('Coupon with the same code')
    ));
}

Remove the addUniqueField call. Don't modify the core file, override it in a custom module.

You'll also need to modify the table salesrule_coupon

`ALTER TABLE salesrule_coupon DROP INDEX UNQ_SALESRULE_COUPON_CODE;`

Again, do this in a custom module as opposed to a direct sql call.

3
  • That was not work, I dont found any key like INDEX UNQ_SALESRULE_COUPON_CODE
    – Rajan Soni
    Commented Dec 23, 2016 at 10:33
  • @Rajan - This would totally depend on what Magento version you're using. I don't even remember what version this was in reference to, sorry.
    – Ben Truby
    Commented Jan 4, 2017 at 15:04
  • @BenTruby this code is working fine but i am heaving an issue, if i add 1 product in cart its fine but if i add 2 different category products in cart and they have their own discount price and if apply coupon it is showing discount 2 times of current discount, like both products have 100-100 rs discount so total should be 200 but its showing 400 discount.
    – Hemant
    Commented Jan 26, 2019 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.