wc_delete_coupon: delete a coupon
Trashes a coupon, or removes it permanently. Marked destructive.
Arguments
| Argument | Required | Meaning |
|---|---|---|
id |
Yes | The coupon |
force |
No | Delete permanently instead of trashing |
dry_run |
No | Report without deleting |
Permissions
Allow WooCommerce catalog writes open, plus manage_woocommerce or edit_shop_coupons.
Review the exact coupon
The preview validates that the ID is a coupon the actor may delete and includes its current fields. Check its code and amount before approving. A wrong object type or missing deletion capability is refused before approval.
Expiring is almost always better
Deleting a coupon that has been used loses the record of what the code was and what it gave away. Setting a past date_expires with wc_update_coupon stops it working, keeps the record readable, and is reversible.
Delete only coupons that were created by mistake or never published.
Trash keeps the code reserved
Without force, the coupon goes to the trash — recoverable from the WordPress admin, and still holding its code. Recreating that code fails while the trashed coupon exists.
That is often the desired behaviour: a retired campaign code stays unusable and unre-creatable. But it surprises people trying to reissue an annual code like BLACKFRIDAY.
To free the code, purge the trash with wc_empty_coupon_trash.
force is irreversible
With force: true the coupon is gone. There is no revision history for coupons, so unless you read it beforehand, the amount, type and expiry are unrecoverable.
Past orders that used the coupon keep their discount — deleting does not rewrite history — but the coupon record backing those orders no longer exists, which makes later reporting harder to interpret.
Deleting does not refund or reverse anything
A live code stops working at checkout, immediately. Customers who were told about it and have not used it yet simply get an error.
If a code is in circulation, the deletion is a public change. Sequence it: announce, expire, then delete later if at all.
Confirm by code, not by ID
Coupon IDs look alike and lists go stale.
Delete the coupon whose code is OLDSPRING — tell me its ID and confirm the code before deleting.
Deleting the wrong coupon is not recoverable with force, and with trashing it is recoverable only if someone notices.
After deleting
- List the coupons and confirm the right one went.
- If the code needs reusing, purge the trash.
- Try the code in a cart and confirm it is rejected.
Common problems
| Symptom | Cause |
|---|---|
| The write is refused | Catalog write gate closed |
| The approved deletion failed | Inspect the target and the returned error; do not replay blindly |
pom_ai_mcp_wc_coupon_not_found |
Wrong ID, or already deleted |
pom_ai_mcp_wc_forbidden |
Missing manage_woocommerce or edit_shop_coupons |
| The code cannot be recreated | The old coupon is in the trash |
| It cannot be restored | force was used |
| Customers report an invalid code | Expected; it was deleted |
Related
wc_update_coupon— expiring is the reversible alternativewc_empty_coupon_trashwc_get_coupon— read before deleting
Object permissions
Catalog access alone does not authorize every object. Updates and private reads check the selected object; variation operations also check its parent product. Deletion requires deletion capabilities. Creating a coupon requires coupon creation and publication capabilities; creating a global attribute requires manage_product_terms. Every write uses the approval workflow.