Actions and Searches
An action is an event a Zap performs after it is triggered. Actions allow you to create new or update existing WooCommerce data from a Zap.
Searches let you find existing WooCommerce data in a Zap, and then use it later in a subsequent step.
Orders¶
The following actions are available for use in your Zaps to create, update or find orders.
Line-Item Enabled Data Fields: Coupon Lines, Fee Lines, Line Items, Meta Data, Shipping Lines, Refunds
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.
Stock Quantity does not updated by default
If WooCommerce manages product inventory, creating or updating an order does not change stock quantity.
You need to adjust it manually, including calculating the new stock level. For example, by adding the following steps to your Zap:
- Add a Find Product step using the product “ID” or “SKU” data for the search.
- Add a Formatter step to calculate the new stock quantity.
- Add an Update Product step to update the “Stock Quantity” field with the new data.
Create Order¶
Creates a new Order in WooCommerce.
Update Order¶
Updates (modifies) an existing Order in WooCommerce.
Tip: Resource ID is Required for Update Steps
An Update action always needs a valid ID to be specified, so that your Zap knows which record to update.
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, and then you can use that in the Update step.
Find Order¶
Searches for an existing Order in WooCommerce. Optionally create one if none are found.
All available search fields can be viewed here. We recommend the using the following search fields:
- Search: Searches the Billing Address, Shipping Address, Billing Last Name or Billing Email fields for the specified string/term/phrase.
- Order ID: Searches for the specified (numeric) order ID.
Tip: Search Sort Order
Searches return the first result found, and make it available in your Zap’s subsequent action step.
Each search has a default sort order, so when definining 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.
Products¶
The following actions are available for use in your Zaps to create, update or find products.
Tip
See the Product Types chapter for a full list of supported WooCommerce product types and functionalities.
Create Product¶
Creates a new simple Product in WooCommerce.
Line-Item Enabled Data Fields: Downloads, Categories, Images, Attributes, 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.
Update Product¶
Updates (modifies) an existing simple Product in WooCommerce.
Tip: Resource ID is Required for Update Steps
An Update action always needs a valid ID to be specified, so that your Zap knows which record to update.
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, and then you can use that in the Update step.
Line-Item Enabled Data Fields: Downloads, Categories, Images, Attributes, 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.
Find Product¶
Searches for an existing Product in WooCommerce. Optionally create one if none are found.
All available search fields can be viewed here. We recommend the using the following search fields:
- SKU: Searches for the specified product SKU.
- Search: Searches the Product Name and Product Description fields for the specified string/term/phrase.
- Product ID: Searches for the specified (numeric) product ID.
Tip: Finding Products from Orders
Please see here for some suggestions on how to find WooCommerce products from WooCommerce Order Line Items.
Tip: Search Sort Order
Searches return the first result found, and make it available in your Zap’s subsequent action step.
Each search has a default sort order, so when definining 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.
Customers¶
The following actions are available for use in your Zaps to create, update or find customers.
What is a Customer?
A Customer in WooCommerce is someone with a user account to log in to your store. People purchasing as a guest (without logging into an account) are not considered customers.
Create Customer¶
Creates a new Customer in WooCommerce.
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.
Update Customer¶
Updates (modifies) an existing Customer in WooCommerce.
Tip: Resource ID is Required for Update Steps
An Update action always needs a valid ID to be specified, so that your Zap knows which record to update.
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, and then you can use that in the Update step.
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.
Find Customer¶
Searches for an existing Customer in WooCommerce. Optionally create one if none are found.
All available search fields can be viewed here. We recommend the using the following search fields:
- Email: Searches for the specified customer email address.
- Search: Searches the Customer Username, Customer Email, Customer URL, Customer Display Name fields for the specified string/term/phrase.
- Customer ID: Searches for the specified (numeric) customer ID.
User Roles
The default search behaviour when searching for Customers is to limit the search to users with the “Customer” Role. However, if you want to broaden the result, please select another item in the dropdown. For example, you can choose “All” to search for every user of the WooCommerce store, including administrators.
Consult the search fields table for available Roles.
WordPress Multisite
If you are using the Create WooCommerce Customer if it doesn’t exist yet option in your Find Customer Zap, and you are also using WordPress multisite, please read the following.
The following error can occur if an email address exists in your multisite network, but isn’t assigned as a customer on an individual site in your network:
Communication error. 400 Bad Request.
registration-error-email-exists
An account is already registered with your email address. Please log in.
This is a limitation in how Multisite is designed, and how WooCommerce itself is designed to work with multisite.
WordPress Multisite stores user (and thus customer) accounts in one place (network-wide), and are then added to an individual site in your network when required.
If you encounter this error, the workaround is to go to WordPress Dashboard → Side Menu → Users → Add New and manually add the user with a Customer role to your sub-site.
Tip: Search Sort Order
Searches return the first result found, and make it available in your Zap’s subsequent action step.
Each search has a default sort order, so when definining 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.
Coupons¶
Only available if the Coupon functionality is enabled in your WooCommerce store. (Enabled by default).
If your WooCommerce store has coupons enabled1, the following actions are available for use in your Zaps to create, update or find coupons.
Create Coupon¶
Creates a new Coupon in WooCommerce.1
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.
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:
Tip: Using the WooCommerce URL Coupons Extension?
Please see here for some suggestions.
Update Coupon¶
Updates (modifies) an existing Coupon in WooCommerce.1
Tip: Resource ID is Required for Update Steps
An Update action always needs a valid ID to be specified, so that your Zap knows which record to update.
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, and then you can use that in the Update step.
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.
Find Coupon¶
Searches for an existing Coupon in WooCommerce. Optionally create one if none are found.1
All available search fields can be viewed here. We recommend the 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.
Tip: Search Sort Order
Searches return the first result found, and make it available in your Zap’s subsequent action step.
Each search has a default sort order, so when definining 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.
Subscriptions¶
If your WooCommerce store has WooCommerce Subscriptions installed4, the following actions are available for use in your Zaps to create, update or find products.
Create Subscription¶
Creates a new Subscription in WooCommerce.4
Line-Item Enabled Data Fields: Coupon Lines, Shipping Lines, Line Items, Removed Line Items
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.
Update Subscription¶
Updates (modifies) an existing Subscription in WooCommerce.4
Tip: Resource ID is Required for Update Steps
An Update action always needs a valid ID to be specified, so that your Zap knows which record to update.
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, and then you can use that in the Update step.
Line-Item Enabled Data Fields: Coupon Lines, Shipping Lines, Line Items, Removed Line Items
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.
Find Subscription¶
Searches for an existing Subscription in WooCommerce. Optionally create one if none are found.4
All available search fields can be viewed here. We recommend the using the following search fields:
- Search: Searches the Billing Address, Shipping Address, Billing Last Name or Billing Email fields for the specified string/term/phrase.
- Subscription ID: Searches for the specified (numeric) subscription ID.
Tip: Search Sort Order
Searches return the first result found, and make it available in your Zap’s subsequent action step.
Each search has a default sort order, so when definining 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.