Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top