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

Start free trial

Create Coupon

store/create-coupon creates a discount coupon: a percentage off, a fixed amount off the cart, or a fixed amount off each product.

A code that already exists is refused rather than quietly creating a second one.

At a glance

Abilitystore/create-coupon
ToolsetWooCommerce — toolset/woocommerce
GroupWooCommerce › Coupons
RequiresWooCommerce, active on the site
Capabilitymanage_options
SafetyWrites data
RepeatableNot idempotent — each call changes the row set, so re-running is not a no-op
Ships inAcrossAI Abilities Manager 0.0.34 and later

Two refusals worth having

Duplicate codes are the first. WooCommerce will happily hold two coupons with the same code, and which one applies is then a matter of query order — so a shop can have a working code that occasionally applies the wrong discount, with nothing to explain it.

An unsupported discount type is the second. Stores can extend the type list, so the accepted set is read from the store rather than assumed, and a type this store does not offer is named rather than stored.

The three built-in types behave differently in ways that matter: percent scales with the cart, fixed_cart comes off once, and fixed_product comes off each qualifying product — which is how a £5-off coupon takes £40 off an order of eight.

Usage limits are the safety net on a public code. A percentage coupon with no limit and no expiry, posted somewhere public, is unbounded.

Input

NameTypeRequiredWhat it is
codestringYesThe code a customer types. Must not already exist.
discount_typestringNo — defaults to fixed_cartpercent, fixed_cart or fixed_product.
amountstringNoThe discount amount. For percent, 10 means ten per cent.
descriptionstringNoInternal description.
date_expiresstringNoExpiry date, YYYY-MM-DD.
usage_limitintegerNoTotal times the coupon may be used.
usage_limit_per_userintegerNoTimes one customer may use it.
minimum_amountstringNoMinimum cart total for the coupon to apply.
maximum_amountstringNoMaximum cart total for the coupon to apply.
individual_usebooleanNoWhether it cannot be combined with other coupons.
free_shippingbooleanNoWhether it grants free shipping.
product_idsarrayNoRestrict to these products.
excluded_product_idsarrayNoExclude these products.
product_categoriesarrayNoRestrict to these categories.

What comes back

NameTypeWhat it is
couponobjectThe created coupon.
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:

Create a 10% off code called WINTER26 that expires at the end of December and can be used once per customer.

It resolves to one call:

{
  "ability": "store/create-coupon",
  "parameters": {
    "code": "WINTER26",
    "discount_type": "percent",
    "amount": "10",
    "date_expires": "2026-12-31",
    "usage_limit_per_user": 1
  }
}

Worth knowing

  • fixed_product comes off each qualifying product, not once per order.
  • A duplicate code is refused. Two coupons with one code is a real and confusing state.
  • Set an expiry or a usage limit on any code that will be public.
  • Not idempotent.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading