Developer Documentation
WooCommerce Zapier is built with third-party developers in mind.
Various built-in WooCommerce features like the WooCommerce REST API, WooCommerce webhooks and t Action Scheduler are used extensively for the integration.
We are unable to provide support for writing custom code
You may need to enlist the help of a professional WordPress/WooCommerce developer if you need assistance.
REST API Endpoints¶
The following REST API endpoints are available for the WooCommerce Zapier integration. These are used exclusively by the WooCommerce app on Zapier.com, and they should not be used by any other third-party applications, as the following endpoints are subject to change without notice.
This list of endpoints is provided as a reference in case they need to be whitelisted by your security plugins or hosting provider.
All endpoint URLs are relative.
Endpoint | Used Method(s) | API |
---|---|---|
/wc-zapier-auth/v1/authenticate | POST | Authentication |
/wp-json/wc-zapier/v1/ | GET | REST Index |
/wp-json/wc-zapier/v1/ping | GET | Authentication test |
/wp-json/wc-zapier/v1/bookings v2.2 WooCommerce Bookings | GET | Bookings Resource |
/wp-json/wc-zapier/v1/coupons Coupons | GET , POST , PUT , OPTIONS | Coupons Resource |
/wp-json/wc-zapier/v1/customers | GET , POST , PUT , OPTIONS | Customers Resource |
/wp-json/wc-zapier/v1/memberships/members v2.10 WooCommerce Memberships | GET , POST , PUT , OPTIONS | User Membership Resource |
/wp-json/wc-zapier/v1/memberships/plans v2.10 WooCommerce Memberships | GET , OPTIONS | Membership Plan Resource |
/wp-json/wc-zapier/v1/orders | GET , POST , PUT , OPTIONS | Orders Resource |
/wp-json/wc-zapier/v1/orders/notes v2.8 | GET , POST , OPTIONS | Order Notes Resource |
/wp-json/wc-zapier/v1/products | GET , POST , PUT , OPTIONS | Products Resource |
/wp-json/wc-zapier/v1/products/prices v2.6 | PUT | Update Product Price |
/wp-json/wc-zapier/v1/products/stocks v2.5 | PUT | Update Product Stock Quantity |
/wp-json/wc-zapier/v1/subscriptions | GET , POST , PUT , OPTIONS | Subscriptions Resource |
/wp-json/wc-zapier/v1/subscriptions/notes v2.9 | GET , POST , OPTIONS | Subscription Notes Resource |
/wp-json/wc-zapier/v1/webhooks | POST , DELETE | Webhooks |
/wp-json/wc-zapier/v1/webhooks/topics/<resource> | GET | Webhooks Topics |
WooCommerce Zapier has never used WooCommerce’s Legacy REST API
Authentication¶
To authenticate, issue a POST
request to the /wc-zapier-auth/v1/authenticate
endpoint with a valid WordPress administrator username and password. Tou may want to use an “Application Password” to provide greater compatibility with third-party plugins.
Upon successful authentication, the response will include a consumer key/secret that you can use for authorisation.
Authorisation¶
You may use the HTTP Basic Auth header by providing the REST API Consumer Key as the username and the REST API Consumer Secret as the password.
curl https://www.example.com/wp-json/wc-zapier/v1/orders -u consumer_key:consumer_secret
Occasionally some servers may not parse the Authorisation header correctly (if you see a “Consumer key is missing” error when authenticating over SSL, you have a server issue). In this case, you may provide the consumer key/secret as query string parameters instead.
REST API¶
The WooCommerce Zapier endpoint behaviours are based on the WooCommerce REST API version 3 and some cases version 1. For detailed information by endpoints, please see the original documentation:
- Bookings
- Coupons
- Customers
- Orders
- Order Notes
- Products
- Membership Plans
- User Memberships
- Subscriptions
- Subscription Notes
WooCommerce Zapier endpoints are differ from built-in WooCommerce endpoints
Even though the WooCommerce Zapier integration is based on the above endpoints, it does not support the following functionality:
- No batch actions.
- No delete support (only create, update and search).
- No subtype access. For example: Order refunds or Product attributes.
Whitelisting¶
Your WordPress dashboard
It isn’t usually feasible or practical to whitelist Zapier’s IP addresses, because they use Amazon AWS, which means the authentication attempts that come from IP addresses are regularly changing.
However, you can set it for the plugin API Endpoints.
Extending Zapier Integration¶
To modify or extend the data transmitted to Zapier via a Webhook or received through the REST API, you can utilise the filters provided by WordPress and WooCommerce. This process typically involves implementing available filters and hooks to append additional fields to the existing REST API endpoints of WooCommerce. By modifying the data within the Webhook payload or the REST API input, these changes will be recognised by WooCommerce and, consequently, by our plugin, which will automatically incorporate them.
Before customising the data flow between WooCommerce and Zapier, the initial step is to pinpoint the hook corresponding to the specific modification you wish to implement. This helps to ensure that your customisations are preserved even when the core software is updated. Identifying the right hook is crucial, as it determines where and how your custom code will interact with WooCommerce’s processes. Once the appropriate hook is identified, you can write and integrate your custom code, which will execute precisely when the hook is called. This process allows for seamless integration of your enhancements, ensuring that the data sent to Zapier via Webhooks or received via the REST API contains all the necessary information tailored to your operational requirements.
It’s crucial to remember that if you introduce any new fields or change behaviour to create, update, or find endpoints, you must also provide schema definitions for these fields. This step is essential because the WooCommerce Zapier integration depends on the endpoint schema definitions to accurately identify the available data fields for each resource/endpoint and build the field interface for the Zap editor. To accomplish this, the woocommerce_rest_{$object_type}_schema
filter can be employed.
Modifying output data¶
You might use the general WordPress rest_post_dispatch
filter to alter the data sent out. Alternatively, you can employ a more specific WooCommerce filter tailored to the resource, such as woocommerce_rest_prepare_{$this->post_type}
.
Accessing incoming data¶
When dealing with incoming data, the general WooCommerce filter woocommerce_rest_{$this->post_type}_query
can be pretty valuable. Additionally, you may opt for other filters more specific to the particular Resource or Action within WooCommerce.
By leveraging these hooks and filters, you can seamlessly customise the data interactions between WooCommerce and Zapier, ensuring a smooth and efficient workflow that caters to your specific requirements.
Useful Documentation¶
Translating¶
You can easily translate the WooCommerce Extension interface to your language using the provided languages/woocommerce-zapier.pot
file as a starting point.
If you do translate WooCommerce Zapier, please contact us and send us the translation file so that we can include it in the extension for others to benefit from.
REST API Logs¶
To understand how WooCommerce Zapier uses the REST API, you may wish to install the REST API Log Plugin.
After installing the plugin, trigger a few of your Zaps and then navigate to WordPress Dashboard → Side Menu → Tools → Rest API Log screen to see which endpoints are queried.