Test Webhooks on WooCommerce

Test Webhooks on WooCommerce

Before continuing to Webhooks, let’s learn what is hooks or hooking?The hooks and hooking are used in programming terms to refer to a number of techniques used to modify the behavior of an application.

Hooks allow you to increase the functionality of an application or an operating system or alter it. The principle of operation is the interception of messages or events between the different components of an application. The code that is executed during these interceptions is called hook.

What are Webhooks?

Webhooks is a term used for sending data to a URL especially when an event occurs. For example, if you subscribes to an email marketing list the service that manages the list can easily send data like the subscriber’s name and email to another system like a Customer Relationship Manager. They are basically used for the integration with third-party services and other external API that support them.

Webhooks in WooCommerce

Webhooks were first introduced in July 2014, in Woocommerce 2.2 in order to trigger events each and every time you add, edit or delete orders, products, coupons or customers. Nowadays  making use of Webhooks with WooCommerce actions is considered as a smart move for the owner and customer. For example, create a webhook to be used every time a product is added to the shopping cart using the action:


Setting up WooCommerce Webhooks

To start your set up, make sure to login to your WooCommerce shop as an administrator. Then go to WooCommerce > Settings and click the API tab.

Webhooks in WooCommerce

Note: Webhooks were formerly found under WooCommerce > Settings > API prior to WooCommerce 3.4.

For those users who are using WooCommerce 3.4 or later version, To create a new webhook: Go to: WooCommerce > Settings > Advanced > Webhooks.

WooCommerce Webhooks

Click the Webhooks link in the sub menu and you’ll see an empty list of webhooks.WooCommerce Webhooks

Create a New Webhook

The first step is to press Create a new webhook. The webhook will be added and then the settings fields will be appeared. The settings fields are described below.

Name– This is only meant for store administrators. Here one can set anything. This will help you to know what the webhook is for.

Status- This means the webhook status of either Active, Paused, or Disabled.

Topic- This can cause Webhook to fire. You will be surprised to know that WooCommerce supplies 12 actions and two custom actions. The pre-defined ones are listed below.

  • Coupon created
  • updated
  • deleted
  • Customer created
  • updated
  • deleted
  • Order created
  • updated
  • deleted
  • Product created
  • updated
  • deleted

There are also Action and Custom options.

  • Action Event: This option is available when the Topic is a WooCommerce Action, such as woocommerce_add_to_cart for when customers add products to the shopping cart.
  • Custom Topic: This option is only for advanced users. It’s possible to introduce a new and customized topics with the help of the following filter:


Delivery URL–  the URL that the webhook payload will be sent to.

Secret– Generally it is used to generate a hash of the webhook’s body, the one which is provided in the request headers.

API Version- The latest version of WooCommerce allows us to choose the API used for the delivery of messages. We have three options:

  • WP Rest API v1
  • WP Rest API v2
  • Legacy API v3 (obsolete)

With this you can create a new webhook.

Editing and deleting webhooks

To edit and delete webhooks,

Go to the Webhooks and find the webhook you wish to alter.

Click on the Webhooks Name and Edit and Delete permanently options appear.

Delete, or make Edits and Save changes. You can delete the Bulk with the dropdown.

Edit Delete Option

Webhook logs

WooCommerce saves the webhook logs of all events triggering a webhook. To find Webhooks logs go to WooCommerce > Status > Logs.

Webhooks Logs

In it, you can find the delivery and response of the server.

One Reply to “Test Webhooks on WooCommerce”

Leave a Reply