Send Full Product Details over WooCommerce Webhook Action Hook

WooCommerce has a webhook feature that allows you to send product data to a webhook url when a certain product status is made. The configuration of the webhooks is at WooCommerce>Settings>Advanced>Webhooks

The product states to choose from to fire the webhook are referred to as Topics and include states like Order Created, Order Updated and Order Deleted.

Topics Webhooks Commerce
Webhook Topics

Firing Webhook with custom WooCommerce Action

Also in the above list is an option for an Action which allows for an Action Event (hook) to be added which allows you to fire the webhook when a WooCommerce hook is fired.

Topics Action Hook Webhooks Commerce
Action woocommerce_order_status_processing

So in the above an action is selected as a Topic then a WooCommerce hook is added – in the example it is :

woocommerce_order_status_processing

Here I want to send the order details only when the order has a state of processing, you can choose from a wide range of hooks, depending when you want to send the data.

The webhook will fire when the action is fired, but one of the main drawbacks of using a WooCommerce custom action is that only a small part of the product data is sent to the webhook url

Webhook Limited Data Returned

So in the Raw Content section only the action name and order number are returned.

Function to send all product details

To get around this limitation there is a function that can be added via the themes functions.php file or as a plugin.

Using this function and changing the webhook ID and data source will now return the full data to the webhook.

Webhook Id Woocommerce
Where to find webhook ID

Now the full order details are sent.

Webhook Full Order Data Returned
Full order data returned in raw content

I am not the author of this code the source is stated in the code gist, however I have used and verify it works, the webhook testing I used is done at https://webhook.site