Create Coupon


Creates a WooCommerce discount coupon with a discount type, amount, and optional restrictions and usage limits.

Also known as: create a discount code, promo code, voucher, special offer.

Property Value
Ability slug mosmcp/create-coupon
Wire tool name mosmcp__create-coupon
Category WooCommerce (mosmcp-woocommerce)
Plan Free

 

Required access

Requirement Value
Capability publish_shop_coupons
Minimum default role Shop manager
Requires WooCommerce
Annotations readOnly: false · destructive: false · idempotent: false · openWorld: false

 

Input schema

Field Type Required Default Description
code string Yes — The coupon code (required).
amount string Yes — The discount amount (required).
discount_type string (one of percent, fixed_cart, fixed_product) percent The discount type. Defaults to percent.
description string — Coupon description.
date_expires string — Expiry date (YYYY-MM-DD). Pass an empty string to clear it.
individual_use boolean — Whether this coupon can be combined with other coupons.
product_ids integer[] — Product IDs this coupon is restricted to. Replaces the existing set entirely; pass an empty array to remove the restriction.
excluded_product_ids integer[] — Product IDs this coupon cannot be used on. Replaces the existing set entirely.
usage_limit integer — Maximum number of times the coupon can be used in total.
usage_limit_per_user integer — Maximum number of times a single customer can use the coupon.
limit_usage_to_x_items integer — Maximum number of items in the cart the coupon applies to.
free_shipping boolean — Whether this coupon grants free shipping.
product_categories integer[] — Category IDs this coupon applies to. Replaces the existing set entirely.
excluded_product_categories integer[] — Category IDs this coupon does not apply to. Replaces the existing set entirely.
exclude_sale_items boolean — Whether this coupon is withheld from items already on sale.
minimum_amount string — Minimum cart subtotal required for this coupon to apply.
maximum_amount string — Maximum cart subtotal this coupon can apply to.
email_restrictions string[] — Email addresses (wildcards allowed, e.g. *@example.com) allowed to use this coupon. Replaces the existing set entirely.

 

Output schema

Field Type Required
success boolean
message string
data object
data.id integer
data.code string
data.amount string
data.date_created string \| null
data.date_modified string \| null
data.discount_type string
data.description string
data.date_expires string \| null
data.usage_count integer
data.individual_use boolean
data.product_ids integer[]
data.excluded_product_ids integer[]
data.usage_limit integer \| null
data.usage_limit_per_user integer \| null
data.limit_usage_to_x_items integer \| null
data.free_shipping boolean
data.product_categories integer[]
data.excluded_product_categories integer[]
data.exclude_sale_items boolean
data.minimum_amount string
data.maximum_amount string
data.email_restrictions string[]
data.used_by string[]
meta object
meta.ability string
meta.timestamp string
meta.execution_time string \| null

 

Example

Sample prompt
Create a coupon AUTUMN15 for 15% off orders over $30, one use per customer, expiring October 31.

Example request (json)

{
  "jsonrpc": "2.0",
  "id": 353,
  "method": "tools/call",
  "params": {
    "name": "mosmcp__create-coupon",
    "arguments": {
      "input": {
        "code": "autumn15",
        "amount": "15",
        "discount_type": "percent",
        "minimum_amount": "30.00",
        "usage_limit_per_user": 1,
        "date_expires": "2026-10-31"
      }
    }
  }
}

Example response (json)

{
  "jsonrpc": "2.0",
  "id": 353,
  "result": {
    "isError": false,
    "structuredContent": {
      "success": true,
      "message": "Coupon created.",
      "data": {
        "id": 210,
        "code": "autumn15",
        "amount": "15",
        "date_created": "2026-09-01T08:00:00",
        "date_modified": "2026-09-01T08:00:00",
        "discount_type": "percent",
        "description": "",
        "date_expires": "2026-10-31T00:00:00",
        "usage_count": 0,
        "individual_use": false,
        "product_ids": [],
        "excluded_product_ids": [],
        "usage_limit": null,
        "usage_limit_per_user": 1,
        "limit_usage_to_x_items": null,
        "free_shipping": false,
        "product_categories": [],
        "excluded_product_categories": [],
        "exclude_sale_items": false,
        "minimum_amount": "30.00",
        "maximum_amount": "",
        "email_restrictions": [],
        "used_by": []
      },
      "meta": {
        "ability": "mosmcp/create-coupon",
        "timestamp": "2026-09-29T10:15:00+00:00",
        "execution_time": "18.4ms"
      }
    }
  }
}

 

Edge cases / errors

  • A coupon with that code already exists → wcab_coupon_exists.
  • Blank code → wcab_missing_code; negative or non-numeric amount → wcab_invalid_price.
  • date_expires not YYYY-MM-DD → wcab_invalid_date; non-numeric minimum_amount/maximum_amount → wcab_invalid_amount.
  • discount_type defaults to percent; the coupon is published and usable immediately.

 


<< Previous Next >>
Coupon Usage Report Create Customer

For more information about the Secure MCP Server for WordPress plugin, explore the following resources:

Product Overview | Pricing | Try for Free | Documentation

If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.