How to remove all commerce coupon from database? Hi I have used commerce coupon module. I have lot of entries of used coupon. So, right now I want to delete all commerce coupon from database. I have 860000 coupon entries in database. How can I delete all entries using custom module functionality?
Since coupons are entities, you'll want to delete them using the entity functions. As an example, if I want to delete all disabled coupons, something like this should work:

$disabled_coupons = commerce_coupon_load_multiple(array(), array('status' =&gt; 0));
$disabled_coupon_ids = array_keys($disabled_coupons);
commerce_coupon_delete_multiple($disabled_coupon_ids);


If you need to batch them, you may want to try doing them in batches of 250-1000... not sure how many can be deleted successfully per batch. Then just let it run.