A Webhook is an event notification sent to a URL of your choice. Users can configure them to trigger events on one site to invoke behavior on another.
Webhooks are useful for integrating with third-party services and other external API that support them.
Webhooks in WooCommerce
Webhooks were introduced in WooCommerce 2.2 and can trigger events each time you add, edit or delete orders, products, coupons or customers.
It’s also possible to use Webhooks with WooCommerce actions, e.g., create a webhook to be used every time a product is added to the shopping cart using the action
Webhooks make it easier for third party apps to integrate with WooCommerce.
Creating, editing and deleting Webhooks
To create a new webhook:
- Go to: WooCommerce > Settings > API > Webhooks.
- Click Add
- Enter your Settings.
- Name: By clicking on the button webhook is initially created with the name as “Webhook created on [date and time of creation]” this is a standard to facilitate the creation, however you can change the name to something else.
- Status: Here you can set the Webhooks status, the options are “Active” (delivers payload), “Paused” (does not deliver), or “Disabled” (does not deliver due delivery failures).
- Topic: Here you can indicate when the webhook will be triggered, we have several options like “Order Created“, “Product Deleted” and “Customer Updated” and we also have the “Action” and “Custom” options.Action Event: This option is available when the Topic is selected as “Action”, should type here one WooCommerce action name, such as woocommerce_add_to_cart for when customers add products to the shopping cart.Custom Topic: Here you can create a custom topic, this option is for advanced users only, it’s possible to introduce new customized topics with the help of woocommerce_webhook_topic_hooks filter.
- Delivery URL: URL where the webhook payload is delivered.
- Secret: The a Secret Key is used to generate a hash of the delivered webhook and provided in the request headers. This will default to the current API user’s consumer secret if not provided.
3. Save Webhook.
Note: On the first time your webhook is saved with the Activated status will be sent a ping to the Delivery URL.
Editing and deleting Webhooks
Webhooks are listed the same way as posts or products, and you can edit or delete using the Edit and Trash links.
WooCommerce saves logs of all events triggering a webhook. Select a webhook and click Edit. Logs are at the bottom of the page.
Logs may be reviewed to see deliveries and the response from the server, making it simpler to integrate and debug.
Help Source directly from WooCommerce
Not started using ShipHero yet? You can go ahead and get started now.
If you just want to learn more about how ShipHero may be able to help solve your challenges, you can schedule a free call with our solutions team.