0

I have a woocommerce site setup that is pulling in products from an external system using the woocommerce REST API.

Everything is coming through fine except the parent_id is not being set.

example data:

{"product": {"title":"Example Shoe","type":"simple","status":"publish","regular_price":"84.00","description":"","short_description":"Trainers","categories":["Mens Trainers"],"catalog_visibility":"visible","attributes":[{"name":"Colour","position":1,"visible":true,"variation":false,"options":["BLACK"]}],"images":[{"src":"","title":null,"alt":"","position":0}],"parent_id":5254}}

I'm a bit stumped as to why, and as it is only an integer posting through I can't see why It wouldn't work.

Any help is appreciated, Thanks.

MattHeywood
  • 181
  • 1
  • 4
  • 18

1 Answers1

1

I figured out after some trial and error that the reason for this is that the parent_id field seems to be used for grouped products so using it for a variable product was causing issues.

MattHeywood
  • 181
  • 1
  • 4
  • 18
  • can I ask how you pull the products in from an external API and map them into Woocommerces' REST API? i am stuck on doing that at the moment. please see: https://stackoverflow.com/questions/75462225/map-api-details-to-wooocommerce-fields – Paul M Feb 15 '23 at 16:54