Support

Account

Home Forums Backend Issues (wp-admin) Use product category for ACF conditions Reply To: Use product category for ACF conditions

  • Hello, and thank you for the reply.
    I’ve read your docs. But i still don’t understand how to proceed.

    I basically need to add 3 options on the ‘type’ section, that are 3 product categories where i want there will be displayed only some ACF Groups.

    For now, i’ve done something like that:

    add_filter('acf/location/rule_values/post_category', 'acf_location_rules_values_user');
    
    function acf_location_rules_values_user( $choices ) {
    
    	$my_filter_list = [0 => 'Books', 1 => 'Ebooks', 19091 => 'Reader'];
    	
        return $my_filter_list;
    }

    Before my array was 0,1,2. But i noticed that, even if i have the setting displayed on my backoffice, it’s totally not working. So i tried to change the ‘2’ with the product category ID. But is always not working.

    What am i doing wrong? I maybe need to first put every category in the array?
    Thank you in advance.
    – Kryuko