Inicio - Documentación - POM AI - 18 MCP - WooCommerce coupon tools - `wc_delete_coupon`: delete a coupon

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.

The dry run does not check the coupon exists

An unusual quirk, and worth knowing: the dry run reports would_delete with the ID you sent before it looks the coupon up.

So a dry run against a wrong or already-deleted ID succeeds and looks encouraging, and the real call then returns pom_ai_mcp_wc_coupon_not_found.

The dry run here confirms the ID you typed, nothing more. Verify the coupon separately:

Read coupon 812 and confirm its code before deleting anything.

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

  1. List the coupons and confirm the right one went.
  2. If the code needs reusing, purge the trash.
  3. Try the code in a cart and confirm it is rejected.

Common problems

Symptom Cause
The write is refused Catalog write gate closed
The dry run succeeded but the deletion failed The dry run does not verify the ID exists
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