I'm trying to manage WooCommerce entirely by its REST API but with no luck, i'm trying to insert a product with variations
- I can succesfully create a product with a POST to
{{url}}/wp-json/wc/v3/products/
- After product creation, i have to create its variations with a POST to a separate endpoint to
{{url}}/wp-json/wc/v3/products/{{product_id}}/variations
, this works too - I can see the product variation created with a GET in
{{url}}/wp-json/wc/v3/products/{{product_id}}/variations
and its own GET{{url}}/wp-json/wc/v3/products/{{product_id}}/variations/{{variation_id}}
- I can correctly see the rows created in the wordpress database
- All calls are a 201 with the expected object as response
However, i'm not able to see any product variations on the woocommerce product page
What i found its that a product with variations that work have an array variations
which contains the variations ids, but when i create a product with API the array of the product created is empty, this would explain why i'm not able to see any product variation on the product page.
This is a sample of product variation that I create:
{
"regular_price": "225",
"status": "publish",
"manage_stock": true,
"stock_quantity": 1,
"stock_status": "instock",
"image": {
"src": "https://via.placeholder.com/150"
},
"on_sale": true,
"shipping_class": "1",
"attributes": [
{
"id": 2,
"name": "Color",
"option": "Red"
},
{
"id": 3,
"name": "Size",
"option": "Xl"
}
]}
I was not able to found a similar issue, any thoughts?