I am trying to add a WooCommerce product from one Wordpress site to another using WooCommerce Rest Api. It's working in some case, but stock management and stock quantity are not working. here is code…
Client library:
https://packagist.org/packages/woothemes/woocommerce-api
Data:
$data = [
'name' => 'Premium Quality',
'title' => 'test',
'type' => 'simple',
'manage_stock' => true,
'stock_quantity' => 40,
'regular_price' => '21.99',
'description' => 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.',
'short_description' => 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.',
];
Response:
I am getting empty response in manage_stock
and stock_quantity
.
Same thing happen when I change the product type to variation, it isn't working either if I update the data sent, according to WooCommerce Rest Api.