How to create a dropdown select of all items in an ACF field group

I have a series of Field Groups, each attached to a specific product category (woocommerce) and I need to be able to access ALL the data regarding each field group on the product category page. This is to be able to dynamically create multi-select dropdowns to use in filtering items in that category.

The closest I’ve been able to accomplish is using this function (for debugging):

function listFields(){
$fields = get_field_objects();

foreach ($fields as $field => $data){
echo ‘<p>’;
echo ‘<b>Label: ‘.$data[‘label’].'</b><br />’;

foreach ($data[‘choices’] as $key => $value ){
echo ‘KEY: ‘.$key.’ VALUE: ‘.$value.'<br />’;
}
echo ‘</p>’;
}

}

This code seems to have problem though that I can’t figure out. It does show categories and the options I need (and where I need them), but it only shows 2 fields in the group. Some of the groups have up to 15 fields.

It runs within a widget shown on all product category pages..

Can someone help me please? this is driving me crazy…

Read more here:: How to create a dropdown select of all items in an ACF field group

Leave a Reply

Your email address will not be published. Required fields are marked *