Rest API Product Variation Images does not work
-
I am using the API to upload products with variations. I first make a post to the API with the main product to this endpoint: https://my.site.com/wp-json/wc/v3/products/
This works fine. Now I am adding the variations (each variation with its own post to the endpoint: https://my.site.com/wp-json/wc/v3/products/MYSKU/variations and am using the following json:
{ "regular_price": "26.99", "sku": "sku-1", "image": [ { "src": "https://my.site.com/my-image-name.jpg" } ], "attributes": [ { "name": "Color", "option": "Blue" } ] }
and everything works fine except when I visit the product page and change the variation, the image does not change with it (which it should). Also when I edit the product in the dashboard, there is no image shown in the variation.
I have changed my theme to Twenty-twenty-one and disabled all plugins, and that did not fix it. The problem must be in the API, since the variation image is not getting attached to the variation through the above code.
The page I need help with: [log in to see the link]
- The topic ‘Rest API Product Variation Images does not work’ is closed to new replies.