younifyd
Menu

Update Coupon

This API helps you to update a coupon.

PUT/coupons/{couponId}

Use it in a workflow

  1. Add a step and choose the WooCommerce connector.
  2. Pick the Update Coupon action (under Coupons).
  3. Fill in the fields below, then reference the result from later steps as {{updateCoupon.response.data}}.

Request

Path parameters

couponIdintegerrequired

ID of coupon to update

Request body

Enter the body as JSON in the step's Body field.

idinteger

Unique identifier for the resource. read-only

codestring

Coupon code. mandatory

amountstring

The amount of discount. Should always be numeric, even if setting a percentage.

date_createdstring (date-time)

The date the coupon was created, in the site's timezone. read-only

date_created_gmtstring (date-time)

The date the coupon was created, as GMT. read-only

date_modifiedstring (date-time)

The date the coupon was last modified, in the site's timezone. read-only

date_modified_gmtstring (date-time)

The date the coupon was last modified, as GMT. read-only

discount_typestring

Determines the type of discount that will be applied.

One ofpercentfixed_cartfixed_productDefault "fixed_cart"

descriptionstring

Coupon description.

date_expiresstring (date-time)

The date the coupon expires, in the site's timezone.

date_expires_gmtstring (date-time)

The date the coupon expires, as GMT.

usage_countinteger

Number of times the coupon has been used already. read-only

individual_useboolean

If true, the coupon can only be used individually. Other applied coupons will be removed from the cart.

Default false

product_idsarray<integer>

List of product IDs the coupon can be used on.

excluded_product_idsarray<integer>

List of product IDs the coupon cannot be used on.

usage_limitinteger

How many times the coupon can be used in total.

usage_limit_per_userinteger

How many times the coupon can be used per customer.

limit_usage_to_x_itemsinteger

Max number of items in the cart the coupon can be applied to.

free_shippingboolean

If true and if the free shipping method requires a coupon, this coupon will enable free shipping.

Default false

product_categoriesarray<integer>

List of category IDs the coupon applies to.

excluded_product_categoriesarray<integer>

List of category IDs the coupon does not apply to.

exclude_sale_itemsboolean

If true, this coupon will not be applied to items that have sale prices.

Default false

minimum_amountstring

Minimum order amount that needs to be in the cart before coupon applies.

maximum_amountstring

Maximum order amount allowed when using the coupon.

email_restrictionsarray<string>

List of email addresses that can use this coupon.

meta_dataarray<object>

Meta data.

idinteger

Meta ID.

keystring

Meta key.

valueobject

Meta value.

display_keystring

Meta key for UI display.

display_valueobject

Meta value for UI display.

json
{
  "id": 0,
  "code": "string",
  "amount": "string",
  "date_created": "2025-01-01T00:00:00Z",
  "date_created_gmt": "2025-01-01T00:00:00Z",
  "date_modified": "2025-01-01T00:00:00Z",
  "date_modified_gmt": "2025-01-01T00:00:00Z",
  "discount_type": "fixed_cart",
  "description": "string",
  "date_expires": "2025-01-01T00:00:00Z",
  "date_expires_gmt": "2025-01-01T00:00:00Z",
  "usage_count": 0
}

Response

Returns 200 with an object. Read it in later steps with {{updateCoupon.response.data.<field>}}.

idinteger

Unique identifier for the resource. read-only

codestring

Coupon code. mandatory

amountstring

The amount of discount. Should always be numeric, even if setting a percentage.

date_createdstring (date-time)

The date the coupon was created, in the site's timezone. read-only

date_created_gmtstring (date-time)

The date the coupon was created, as GMT. read-only

date_modifiedstring (date-time)

The date the coupon was last modified, in the site's timezone. read-only

date_modified_gmtstring (date-time)

The date the coupon was last modified, as GMT. read-only

discount_typestring

Determines the type of discount that will be applied.

One ofpercentfixed_cartfixed_productDefault "fixed_cart"

descriptionstring

Coupon description.

date_expiresstring (date-time)

The date the coupon expires, in the site's timezone.

date_expires_gmtstring (date-time)

The date the coupon expires, as GMT.

usage_countinteger

Number of times the coupon has been used already. read-only

individual_useboolean

If true, the coupon can only be used individually. Other applied coupons will be removed from the cart.

Default false

product_idsarray<integer>

List of product IDs the coupon can be used on.

excluded_product_idsarray<integer>

List of product IDs the coupon cannot be used on.

usage_limitinteger

How many times the coupon can be used in total.

usage_limit_per_userinteger

How many times the coupon can be used per customer.

limit_usage_to_x_itemsinteger

Max number of items in the cart the coupon can be applied to.

free_shippingboolean

If true and if the free shipping method requires a coupon, this coupon will enable free shipping.

Default false

product_categoriesarray<integer>

List of category IDs the coupon applies to.

excluded_product_categoriesarray<integer>

List of category IDs the coupon does not apply to.

exclude_sale_itemsboolean

If true, this coupon will not be applied to items that have sale prices.

Default false

minimum_amountstring

Minimum order amount that needs to be in the cart before coupon applies.

maximum_amountstring

Maximum order amount allowed when using the coupon.

email_restrictionsarray<string>

List of email addresses that can use this coupon.

meta_dataarray<object>

Meta data.

idinteger

Meta ID.

keystring

Meta key.

valueobject

Meta value.

display_keystring

Meta key for UI display.

display_valueobject

Meta value for UI display.

json
{
  "id": 0,
  "code": "string",
  "amount": "string",
  "date_created": "2025-01-01T00:00:00Z",
  "date_created_gmt": "2025-01-01T00:00:00Z",
  "date_modified": "2025-01-01T00:00:00Z",
  "date_modified_gmt": "2025-01-01T00:00:00Z",
  "discount_type": "fixed_cart",
  "description": "string",
  "date_expires": "2025-01-01T00:00:00Z",
  "date_expires_gmt": "2025-01-01T00:00:00Z",
  "usage_count": 0
}

Need more? See the WooCommerce guide for connection setup and behaviour shared by every action.

Update Coupon — WooCommerce — Documentation