Support

Account

Home Forums General Issues Filter products/categories/ by ACF field Reply To: Filter products/categories/ by ACF field

  • I’m not sure I explained well what I try to reach…

    To be sure :
    Products = post
    Categories = taxonomy

    When I go to this endpoint : https://mywebsite/wp-json/wc/v3/products/categories/
    I receive all the categories available for the products from the api.
    So there isn’t any filter. Screenshot enclose

    Before I will create a new category I need to know if the category already exist or not.

    I add a ACF field on the category to insert a unique ID.
    On the screenshot you can see coming from the plugin ACF-to-rest-api
    “acf”: {
    “id_category_mercator”: “merca1”
    },

    So the unique ID is “merca1”

    Now I want to ask the api to return me all the categories where there is “merca1” in the field “id_category_mercator”.
    Those values are stored in the table termmeta

    If it’s working, the api will return me 1 category and not all the list.

    Is it so more clear what I’m looking for or are your samples the correct ones ?

    Thanks in advance,