How to use woocommerce webhook woocommerce_add_to_cart "arg" JSON value at third party application (with REST API) to request a woo commerce product?

103 views Asked by At

In the process the development of the syncronization solution between onprem Navision (through REST api) and WooCommerce.

Would like to keep Woo commerce product stock info up to date. I do not know what to do with the "arg",recieved from woocommerce_add_to_cart webhook response:

woocommerce_add_to_cart webhook response: {"action":"woocommerce_add_to_cart","arg":"fe9fc289c3ff0af142b6d3bead98a923"}

The Main question is what are repro steps call the WP function (WC_Cart get_cart_item()) to get the product by "arg":"fe9fc289c3ff0af142b6d3bead98a923" (CartPrtoductId) on the 3rd party api.

I saw this post but there is no full answer.

What is the "arg" field value that is sent on woocommerce_add_to_cart webhook?

I consider whether one webhook may be used to send added to cart "cart product Id" (woocommerce_add_to_cart) to the second (WC_Cart get_cart_item()) which in turn will send the response as the Product JSON tho the 3rd party API. I guess the first webhook may send the data directly to the second and the second to the REST API If that's possible of cause.

Regards, Denys

0

There are 0 answers