P粉4289867442023-09-04 18:08:46
See if I can help you. I think what you can do is use the PHP OR operator which is basically two pipes "||". The OR operator works by combining conditions and then if at least one condition is true, PHP executes the if block. If both conditions are false, PHP will not execute the if block statement. Of course, if you have a lot of properties, there may be more efficient ways to do this, but I hope this helps!
Also remember to make sure the required properties in the navigation menu are archived. You can do this by going to Product -> Properties, then hovering over the property and clicking "Edit". On the edit screen, make sure the "Enable archiving" checkbox is selected.
The following is an example of this function:
add_filter('woocommerce_attribute_show_in_nav_menus', 'wc_reg_for_menus', 1, 2); function wc_reg_for_menus( $register, $name = '' ) { if ( $name == 'pa_druivensoort' || 'pa_secondattribute' || 'pa_thirdattribute') $register = true; return $register; }