Written by Giles Bennett
Delete expired coupons programmatically in Magento
A customer the other day installed an extension which then created a fair few unique coupons (in the hundreds), each valid for two days. When the two days had gone, they then wanted to delete expired coupons programmatically. So this is what I came up with for them. In this particular instance there were other expired coupons that they didn't want removed, so we were matching on the first part of the coupon's name, and not just its expiry date.

About the author
Giles Bennett built his first website in 1996, and is old enough to miss Netscape Navigator. Initially a lawyer, he jumped ship to IT in 2008, and after 5 years as a freelancer, he founded HummingbirdUK in 2013. He can be reached by email at giles@hummingbirduk.com.