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,
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?
— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.