Is there a way to get a looper to return only unique values?

I have an ACF text field added to Products (WooCommerce) for “Brand.”

Now, I want to create a list of all of the brands that have been entered in that field. I was able to create a looper using the “Query Builder” option and selecting “Products” in the “Posts” field, and then using dynamic content to display the “Brand” in the looper consumer.

This works well except that it repeats the same value multiple times. For example, if I have 5 products with the brand “Nike,” I see “Nike” 5 times. Is there a way to for the looper to show “Nike” only once?

Hello @dannikb,

Thanks for writing to us.

I would suggest you go to the Looper settings —>Meta —>Select the meta key and Comparison as equal and then add the meta value as “Nike”.


Thanks

Won’t this ONLY return “Nike”? I want to return every value, just once each.

Hi Danni,

Unfortunately, there is no option to get only the unique values through the Looper Provider. If you want to show only the brands, you can use the Query String to get the taxonomies only. In that case, it will only return the brands. If you are trying to show it in another way, you can use the Custom Looper and call a method that returns the unique values only.
To get more information on Looper Provider > Custom, kindly check this out: https://theme.co/docs/loopers#custom You can also go through the following thread on custom loopers, which may help you with this.


Hope it helps.
Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.