How to update variable product stock status with code
Most parts of your code were unnecessary. Assuming you get the correct set of posts with your get_posts(), you can just loop through those posts, and update the meta. You also had a confusion of the variables and objects in your loop, and you tried to update/get information passing a post object instead of an … Read more