30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

Update Coupon

store/update-coupon changes an existing coupon by its code: the amount, the expiry, the limits, the restrictions.

A code that does not exist is refused rather than created.

At a glance

Abilitystore/update-coupon
ToolsetWooCommerce — toolset/woocommerce
GroupWooCommerce › Coupons
RequiresWooCommerce, active on the site
Capabilitymanage_options
SafetyWrites data
RepeatableIdempotent — running it twice leaves the same result
Ships inAcrossAI Abilities Manager 0.0.34 and later

How it works

Refusing rather than creating is the right behaviour for an update addressed by a human-typed string. A typo in a coupon code should produce an error, not a new coupon with a misspelled code sitting alongside the real one.

The usage count survives an update. That matters when you are raising a limit: a coupon used 100 times against a limit of 100 needs the limit raised, and raising it to 150 gives fifty more uses rather than a hundred and fifty.

Changing the amount affects future orders only. Orders already placed keep the discount they were given, which is correct and occasionally surprising — the fix for a coupon that was too generous is to change it and accept the orders already through.

An empty string on date_expires removes the expiry entirely, which is the one way to make a coupon open-ended again.

Input

NameTypeRequiredWhat it is
codestringYesThe code of the coupon to change.
discount_typestringNopercent, fixed_cart or fixed_product.
amountstringNoThe discount amount.
descriptionstringNoInternal description.
date_expiresstringNoExpiry date, YYYY-MM-DD. An empty string removes it.
usage_limitintegerNoTotal times the coupon may be used.
usage_limit_per_userintegerNoTimes one customer may use it.
minimum_amountstringNoMinimum cart total.
maximum_amountstringNoMaximum cart total.
individual_usebooleanNoCannot be combined with other coupons.
free_shippingbooleanNoGrants free shipping.
product_idsarrayNoRestrict to these products.
excluded_product_idsarrayNoExclude these products.
product_categoriesarrayNoRestrict to these categories.

What comes back

NameTypeWhat it is
couponobjectThe coupon after the write.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation.

Example

Ask your assistant:

Extend WINTER26 to the end of January.

It resolves to one call:

{
  "ability": "store/update-coupon",
  "parameters": {
    "code": "WINTER26",
    "date_expires": "2027-01-31"
  }
}

Worth knowing

  • A code that does not exist is refused, not created.
  • The usage count is kept. Raising a limit gives the difference, not the whole new number.
  • Changing the amount affects future orders only.
  • An empty date_expires removes the expiry.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading