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?