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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -