Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Activate coupons sale rules by specific expiration date.
<?php
$collection = Mage::getModel('salesrule/coupon')->getCollection()->addFieldToFilter('expiration_date', array('eq' => '2016-12-30 00:00:00'));
foreach($collection as $coupon) {
$rule = Mage::getModel('salesrule/rule')->load($coupon->getRuleId());
$rule->setIsActive(true)->save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment