Coupon
Trigger Rules¶
A Trigger Rule defines an event (or multiple events) that will cause WooCommerce data to be sent to a Zapier Zap.
The following trigger rules are available to trigger your Zaps when coupon data in your WooCommerce store is added, changed or deleted.
Coupon created¶
Triggers when a coupon is created.
Coupon deleted¶
Triggers when a coupon is deleted (trashed).
Due to limitations in how WooCommerce handles deleted events, only the ID
of the deleted resource is sent to Zapier when using this trigger rule. No other data fields are available.
Coupon restored¶
Triggers when an already trashed coupon is restored from the trash.
Coupon updated¶
Triggers when a coupon is updated/edited/changed/modified.
Actions and Searches¶
The following actions are available for use in your Zaps to create, update or find coupons.
Line-Item Enabled Data Field: Meta Data
To specify multiple values for these field(s), the values must be sent in a line-item aware format. Please see here for details on how the Line Itemizer can be used to achieve this.
Create Coupon¶
Creates a new Coupon in WooCommerce.
A common use case of this action is to automatically create a unique coupon code for each customer that joins your mailing list.
To achieve this, in your Zap’s Create Coupon action, you would set the Email Restrictions data field to your customer’s email address from the Trigger (step 1) part of your Zap:
When automatically creating Coupons in Zaps, it’s usually best to use simple, unique alphanumeric coupon codes.
You can add a Code by Zapier step to your Zap which automatically generates an alphanumeric coupon code (a-z, 0-9 and hyphens only) based on the customer’s email address:
Input Data:
customer
→ User Email Address From Step 1 in Your Zap (or any other uniquely identifiable information such as a customer name).
// Generate an alphanumeric coupon code
// (a-z, 0-9 and hyphens) based on the input.
return { slug: input.customer.replace(/[^A-Za-z0-9-]+/g, "") };
You can then use the result of this Code by Zapier step in your Create Coupon action:
Please see here for some suggestions for using the WooCommerce URL Coupons Extension.
Create Input Fields¶
NAME | TYPE | DESCRIPTION |
---|---|---|
Code | string | Coupon code. Required |
Amount | string | The amount of discount. Should always be numeric, even if setting a percentage. |
Status | string | The status of the coupon. Should always be draft, published, or pending review |
Discount Type | string | Determines the type of discount that will be applied. |
Description | string | Coupon description. |
Date Expires | date-time | The date the coupon expires, in the site’s timezone. |
Individual Use | boolean | If true, the coupon can only be used individually. Other applied coupons will be removed from the cart. |
Product Ids | array | List of product IDs the coupon can be used on. |
Excluded Product Ids | array | List of product IDs the coupon cannot be used on. |
Usage Limit | integer | How many times the coupon can be used in total. |
Usage Limit per User | integer | How many times the coupon can be used per customer. |
Limit Usage to X Items | integer | Max number of items in the cart the coupon can be applied to. |
Free Shipping | boolean | If true and if the free shipping method requires a coupon, this coupon will enable free shipping. |
Product Categories | array | List of category IDs the coupon applies to. |
Excluded Product Categories | array | List of category IDs the coupon does not apply to. |
Exclude Sale Items | boolean | If true, this coupon will not be applied to items that have sale prices. |
Minimum Amount | string | Minimum order amount that needs to be in the cart before coupon applies. |
Maximum Amount | string | Maximum order amount allowed when using the coupon. |
Email Restrictions | array | List of email addresses that can use this coupon. |
Meta Data | array | Meta data. Only the child fields are visible in the Zapier UI. |
Meta Data → Key | string | Meta key. |
Meta Data → Value | any | Meta value. |
Update Coupon¶
Updates (modifies) an existing Coupon in WooCommerce.
An update action always requires a valid top-level ID to be specified. This ensures that your Zap knows which record to update. On the other hand, any non-top-level ID is optional. If you leave it empty, WooCommerce will create a new entry, such as a new Meta Data item.
To help identify the correct Resource ID, you can add a Find step before your update step. The result of your Find step will contain the Resource ID, which you can then use in the Update step.
Update Input Fields¶
NAME | TYPE | DESCRIPTION |
---|---|---|
Existing ID | integer | Unique identifier for the resource. Required |
Code | string | Coupon code. |
Amount | string | The amount of discount. Should always be numeric, even if setting a percentage. |
Status | string | The status of the coupon. Should always be draft, published, or pending review |
Discount Type | string | Determines the type of discount that will be applied. |
Description | string | Coupon description. |
Date Expires | date-time | The date the coupon expires, in the site’s timezone. |
Individual Use | boolean | If true, the coupon can only be used individually. Other applied coupons will be removed from the cart. |
Product Ids | array | List of product IDs the coupon can be used on. |
Excluded Product Ids | array | List of product IDs the coupon cannot be used on. |
Usage Limit | integer | How many times the coupon can be used in total. |
Usage Limit per User | integer | How many times the coupon can be used per customer. |
Limit Usage to X Items | integer | Max number of items in the cart the coupon can be applied to. |
Free Shipping | boolean | If true and if the free shipping method requires a coupon, this coupon will enable free shipping. |
Product Categories | array | List of category IDs the coupon applies to. |
Excluded Product Categories | array | List of category IDs the coupon does not apply to. |
Exclude Sale Items | boolean | If true, this coupon will not be applied to items that have sale prices. |
Minimum Amount | string | Minimum order amount that needs to be in the cart before coupon applies. |
Maximum Amount | string | Maximum order amount allowed when using the coupon. |
Email Restrictions | array | List of email addresses that can use this coupon. |
Meta Data | array | Meta data. Only the child fields are visible in the Zapier UI. |
Meta Data → Existing ID | integer | Meta ID. Leave empty to create a new meta data record. Otherwise, enter an existing ID. |
Meta Data → Key | string | Meta key. |
Meta Data → Value | any | Meta value. |
Find Coupon¶
Searches for an existing Coupon in WooCommerce. Optionally create one if none are found.
All available search fields can be viewed here. We recommend using the following search fields:
- Code: Searches for the specified coupon code.
- Search: Searches the Coupon Name and Coupon Description fields for the specified string/term/phrase.
- Coupon ID: Searches for the specified (numeric) coupon ID.
Searches return the first result found
Each search has a default sort order, so when defining your Search step, you can use the Order and Orderby fields to choose (for example) whether the most recent result or the oldest result is returned from your search.
Search Input Fields¶
NAME | TYPE | DESCRIPTION |
---|---|---|
Coupon Id | string | Limit search by ID. |
Search | string | Limit results to those matching a string. |
Modified After | string | Limit response to resources modified after a given ISO8601 compliant date. |
Modified Before | string | Limit response to resources modified before a given ISO8601 compliant date. |
Order | string | Order sort attribute ascending or descending. |
Orderby | string | Sort collection by object attribute. |
Code | string | Limit result set to resources with a specific code. |
Coupon Data¶
NAME | TYPE | DESCRIPTION |
---|---|---|
Id | integer | Unique identifier for the object. |
Code | string | Coupon code. |
Amount | string | The amount of discount. Should always be numeric, even if setting a percentage. |
Status | string | The status of the coupon. Should always be draft, published, or pending review |
Date Created | date-time | The date the coupon was created, in the site’s timezone. |
Date Modified | date-time | The date the coupon was last modified, in the site’s timezone. |
Discount Type | string | Determines the type of discount that will be applied. |
Description | string | Coupon description. |
Date Expires | date-time | The date the coupon expires, in the site’s timezone. |
Usage Count | integer | Number of times the coupon has been used already. |
Individual Use | boolean | If true, the coupon can only be used individually. Other applied coupons will be removed from the cart. |
Product Ids | array | List of product IDs the coupon can be used on. |
Excluded Product Ids | array | List of product IDs the coupon cannot be used on. |
Usage Limit | integer | How many times the coupon can be used in total. |
Usage Limit per User | integer | How many times the coupon can be used per customer. |
Limit Usage to X Items | integer | Max number of items in the cart the coupon can be applied to. |
Free Shipping | boolean | If true and if the free shipping method requires a coupon, this coupon will enable free shipping. |
Product Categories | array | List of category IDs the coupon applies to. |
Excluded Product Categories | array | List of category IDs the coupon does not apply to. |
Exclude Sale Items | boolean | If true, this coupon will not be applied to items that have sale prices. |
Minimum Amount | string | Minimum order amount that needs to be in the cart before coupon applies. |
Maximum Amount | string | Maximum order amount allowed when using the coupon. |
Email Restrictions | array | List of email addresses that can use this coupon. |
Used by | array | List of user IDs (or guest email addresses) that have used the coupon. |
Meta Data | array | Meta data. |
Meta Data → Id | integer | Meta ID. |
Meta Data → Key | string | Meta key. |
Meta Data → Value | any | Meta value. |
Data Fields May Differ in Your WooCommerce Store
Zapier Integration for WooCommerce utilises WooCommerce’s REST API. Data field names, descriptions, and values can vary from one WooCommerce store to another.
Your store’s data, fields, and trigger rules may differ from this documentation due to any of the following:
- WordPress versions and the locale/language used.
- Your WooCommerce versions and the features enabled.
- Your active WordPress plugins and WooCommerce extensions.
- Any custom code that overrides or changes how the WooCommerce/WordPress REST API operates.
Note: The field definitions are generated using the following settings:
- WordPress v6.6 with the
en_US
locale. - WooCommerce v9.2 with tax and coupon functionality enabled.
- The WooCommerce Bookings, WooCommerce Memberships, and WooCommerce Subscriptions plugins were active.