I have a program that sends products to the woocommerce backed website. I succesfully have it sending single products but variable products are only 90% of the way there.
When I send it I create the parent product, then I create the sub products. I update the meta of the parent product and set the _product_attributes meta value correctly. In fact if I look in the back end of the website I get the following sort of view:
What you may notice is that the variations have "Any Size" instead of stating which size they are linked to. I manually did the top one to confirm the problem and it indeed fixed the issue. However, I am trying to find what actually happens in the database when a product is "linked" in this way. I have tried to compare the parent post in the posts and the postmeta and the child product in the post and the postmeta tables and for the life of me I have spent more than 6 hours and can't find the issue.
I even created a product directly in wordpress and noticed that what I want happens when Link all variations is clicked. But again I would rather not get sucked in to the spaghetti code to try and find what field I am missing if anyone knows this already.
I hope you can help, please let me know if you require more information.