I want to add some custom condition based on cart item's custom option
on coupon code.
For this I am using salesrule_validator_process
event and also added code for cart item's custom option
condition but how to remove coupon or not allow to apply when condition not matched?
Here is my code :
$quote = Mage::getSingleton('checkout/session')->getQuote();
$cartItems = $quote->getAllVisibleItems();
foreach ($cartItems as $item)
{
$info_buyRequest = $item->getOptionByCode('info_buyRequest');
$buyRequest = unserialize($info_buyRequest->getValue());
if($custom_condition)
{
return true;
}
else
{
return false; // here I want to remove coupon or not allow to apply
}
}
How to do that?