skip to Main Content

I am setting up a site (WP) which will essentially sell one type of product and integrating a mobile app (ionic).
Multiple vendors can sell (WC Vendors) the variable product on the site at different quantities (100 litres, 200 litres etc).

I need to be able to make a GET request to return each vendors variable product for that quantity.

e.g. Customer selects they want 300 litres in the mobile app, I then use the API to return all variable products for that quantity (300 litres). So in the end, I have a response which will contain something like below;
Vendor: Vendor 1, Product: Product Name, Quantity: 300 litres, Price: £200

Is this possible as the WC API stands now?

2

Answers


  1. Chosen as BEST ANSWER

    For anyone else struggling on this, I finally got it to work by using the tags as suggested above and to query by tags using this;

    https://example.com/wp-json/wc/v3/products?tag=20?consumer_key=ck_xxxxxxxxxxxxxxxxx&consumer_secret=cs_2xxxxxxxxxxxxx


  2. I think you need to rephrase this a little bit, But From what I can get. You have a Vendor and a Product that has a Quantity of 300 L which in the first place I’d recommend you Should avoid, Rather just use Liter , Now what I’d Recommend is Tag’s.

    You’d have your Vendors and products under Categories.
    And you can Set Tags on Products that you’d like to have what you require.

    Then When someone Selects 300L , 200L It will pull every Product with the Tag 200L And you’ll be able to display them.

    Official Document

    /wp-json/wc/v3/products/tags/<id>
    

    They have:

    • id integer Unique identifier for the resource. name string Tag name.
    • slug string An alphanumeric identifier for the resource unique to its type.
    • description string HTML description of the resource.
    • count integer Number of published products for the resource.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search