Create WooCommerce Coupon
woocommerce_create_couponCreate a discount coupon in WooCommerce by specifying a unique code, discount type, and amount. Supports optional settings like expiry date, usage limits, and product restrictions.
Instructions
Create a new discount coupon.
Args:
code (string, required): the code customers enter at checkout
discount_type: 'percent'|'fixed_cart'|'fixed_product' (default: fixed_cart)
amount (string, required): numeric string
description, date_expires (YYYY-MM-DD), individual_use, usage_limit, usage_limit_per_user, free_shipping, minimum_amount, maximum_amount, product_ids, excluded_product_ids, email_restrictions (all optional)
response_format ('markdown'|'json'): default 'markdown'
Returns: The newly created coupon object with its assigned ID.
Examples:
Use when: "create a 20% off coupon called SUMMER20 that expires end of August" -> code="SUMMER20", discount_type="percent", amount="20", date_expires="2026-08-31"
Error Handling:
Returns "Error: Bad request (400)" if the coupon code already exists.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Coupon code customers will enter at checkout, e.g. 'SUMMER20' | |
| amount | Yes | Discount amount as numeric string (percent value or currency amount depending on discount_type) | |
| description | No | ||
| product_ids | No | Restrict coupon to these product IDs | |
| usage_limit | No | Max total number of times this coupon can be used | |
| date_expires | No | Expiry date in YYYY-MM-DD format; omit for no expiry | |
| discount_type | No | 'percent', 'fixed_cart', or 'fixed_product' (default: fixed_cart) | fixed_cart |
| free_shipping | No | If true, grants free shipping when applied | |
| individual_use | No | If true, this coupon cannot be combined with other coupons | |
| maximum_amount | No | Maximum cart subtotal allowed, numeric string | |
| minimum_amount | No | Minimum cart subtotal required, numeric string | |
| response_format | No | Output format: 'markdown' for human-readable text or 'json' for machine-readable structured data | markdown |
| email_restrictions | No | Restrict usage to these customer email addresses | |
| excluded_product_ids | No | Exclude these product IDs from the coupon | |
| usage_limit_per_user | No | Max times a single customer can use this coupon |