Hi @mezhik91,
Do you know how WooCommerce stores variation IDs? I think product variations are there own custom post type, right? What is the link between a product and product variations? I am not sure and it would take some digging to find that out.
Let me know.
Thank you,
Kevin.
Hi @yikesitskevin,
Thank you for such a quick response.
well.. I have never before worked with WP so I’m not sure if I’m right but from what I see in database – variants are being stored in wp_posts table and have field “post_parent” which is a link to a product. Also variants have different post_type – “product_variation”. So the first think that comes to my mind – it is do something like as said before:
/wp/v2/product_variation?filter[post_parent]=16
or
/wp/v2/product_variation?post_parent=16
but both are not working..
BR
Honestly, I am not sure how to filter on the post_parent property. You’ll need to review the WPQuery/WP REST API docs.
Are you able to see product variations at /wp/v2/product_variation? Are you using our plugin to enable this endpoint?
1. Yes, I am able to see variations at /wp/v2/product_variation;
2. And yes, I am using your plugin to enable this endpoint 🙂
Okay that’s good. Unfortunately I can’t look into the issue with filtering by parent ID right now. I might have some time next week but I think you should read through the WordPress REST API and WP Query documentation to see if this is possible.
Our plugin doesn’t add any additional filtering capability – all of that is handled by core WordPress API code.
Ok, thank you! I will read WordPress REST API docs and sorry in case if it isn’t relevant to your plugin. I just had to start somewhere 😀
No problem – sorry I couldn’t help more – if you’re still struggling to find any answers after reviewing the documentation let me know 🙂