wordpress - update product meta_data in wocommerce REST API -


i added new field using small plugin script... works fine in woocommerce interface , shows using rest api product

here 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 price ignores (without error) meta_data

i searched web morning didn't find clear solution (some suggested have register_meta(), made tests nothing changed (the meta data show before registering))

following code used create filed in "admin" part of 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 ); 

any clue?

have tried this?

$data = [     'regular_price' => '21.00',     'meta_data' => [         ['key' => 'kambusa'],         ['value' => '456']     ] ]; 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -