I think you’re looking to use WordPress’s REST API. This is something I have been researching as well.
Below is WooCommerce’s REST API documentation:
https://woocommerce.github.io/woocommerce-rest-api-docs/
You can build an intermediary app in php, node, etc to pull your data and push it to WooCommerce with REST and JSON
An example would be as below for a batch update:
Note: You would of course have to code “pulling” your data into a json format that suits “pushing” and is beyond the scope of what I’m trying to explain. This is by no means an exhaustive tutorial. Hope it gives you an idea on how to get started. I’m still figuring this out myself! ??
Source: WooCommerce – Batch Update Products – REST
<?php
$data = [
'create' => [
[
'name' => 'Woo Single #1',
'type' => 'simple',
'regular_price' => '21.99',
'virtual' => true,
'downloadable' => true,
'downloads' => [
[
'name' => 'Woo Single',
'file' => 'https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg'
]
],
'categories' => [
[
'id' => 11
],
[
'id' => 13
]
],
'images' => [
[
'src' => 'https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg'
]
]
],
[
'name' => 'New Premium Quality',
'type' => 'simple',
'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.',
'categories' => [
[
'id' => 9
],
[
'id' => 14
]
],
'images' => [
[
'src' => 'https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_front.jpg'
],
[
'src' => 'https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_back.jpg'
]
]
]
],
'update' => [
[
'id' => 799,
'default_attributes' => [
[
'id' => 6,
'name' => 'Color,
'option' => 'Green'
],
[
'id' => 0,
'name' => 'Size',
'option' => 'M'
]
]
]
],
'delete' => [
794
]
];
print_r($woocommerce->post('products/batch', $data));
?>
-
This reply was modified 4 years, 12 months ago by
vinayvidyasagar. Reason: Added WooCommerce API Resource links and example
-
This reply was modified 4 years, 12 months ago by
vinayvidyasagar.