• Resolved mezhik91

    (@mezhik91)


    Hello! I find your plugin very nice and useful.
    Few days ago I came across an issue. I installed WooCommerce plugin and want to get product (through Wp rest api) with ids of its variants but I can”t find any way to achieve it 🙁 Do you maybe know how to handle it? Or is there any filter functionality where I could do something like this: /wp-json/wp/v2/product_variation?filter[parent_id]=16
    Thank you

    • This topic was modified 7 years, 1 month ago by mezhik91.
    • This topic was modified 7 years, 1 month ago by mezhik91.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor yikesitskevin

    (@yikesitskevin)

    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.

    Thread Starter mezhik91

    (@mezhik91)

    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

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    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?

    Thread Starter mezhik91

    (@mezhik91)

    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 🙂

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    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.

    Thread Starter mezhik91

    (@mezhik91)

    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 😀

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    No problem – sorry I couldn’t help more – if you’re still struggling to find any answers after reviewing the documentation let me know 🙂

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘WooCommerce integration’ is closed to new replies.