I added a new field using a small plugin script... it works fine in Woocommerce interface and also shows up using the REST API to get a product
Here an excerpt of results using $woocommerce->get()
'meta_data' =>
array (size=1)
0 =>
array (size=3)
'id' => int 3293
'key' => string 'kambusa' (length=7)
'value' => string '123' (length=3)
using:
$data = [
'regular_price' => '21.00',
'meta_data' => [
['kambusa' => '456']
]
];
print_r($woocommerce->put('products/530', $data));
Updates only the price but ignores (without any error) the meta_data.
I searched the web all the morning but didn't find any clear solution
(some suggested I have to register_meta(), made some tests but nothing changed (the meta data show also before registering))
Following the code used to create the field in the "admin" part of my plugin:
$args = array(
'id' => $this->textfield_id,
'label' => sanitize_text_field( 'Kambusa ID' ),
'placeholder' => $placeholder,
'desc_tip' => true,
'description' => $description,
);
woocommerce_wp_text_input( $args );