How to change the response of WebHook in WooCommerce?

0

I have a problem in the WooCommerce REST_API, in the case of the response of the wp-json / wc / v2 / orders endpoint, in the products (line_items) the metadata is not returned > ( metadatas of the products).

Asintheimageabove,itcanbeseenthatthevaluesforthemetadatasareempty!

Isolvedthisquestionusingregister_rest_field,thisisthesolutioncodebelow!

ThesolutionaddsthekeyproductstotheREST_APIresponse,insidethatarrayhastheproductidalongwiththemetadatasIneed!

The problem is that I want this change to be applied in WebHook, I thought that changing the response of the endpoint of REST_API would also change the response of the WebHook. But this script did not work on WebHook.

Can anyone help me solve this problem?

    
asked by anonymous 08.03.2018 / 14:30

1 answer

0

I was able to solve my problem using the filter

*woocommerce_rest_prepare_{$post_type}_object*!

That was the solution:

    
12.03.2018 / 15:01