I have this code that creates a new product in WooCommerce:
$woocommerce = new Client(
'http://www.xxxx.com.br',
'ck_xxxxxx',
'cs_xxxxxx',
[
'wp_api' => true, // Enable the WP REST API integration
'version' => 'wc/v1' // WooCommerce WP REST API version
]
);
$data = [
'name' => 'Premium Quality',
'type' => 'variable',
'sku' => '123450000',
];
print_r($woocommerce->post('products', $data));
The product is inserted into the database with the name Premium Quality, the problem is that the SKU is not inserted, and when I try to view in the WordPress panel I see that it is empty.
Why is this happening?
My wordpress and WooCommerce are upgraded to the latest version (and my PHP API too => 1.3.0)