By default, global groups can be displayed depending on product category (as well as universally or by specific product).
If you’d prefer to display global groups depending on product attribute or an alternative taxonomy, e.g. Brand, you can use the following snippet.
Just enter the slug of the taxonomy you wish to use instead of product category. In this example, the plugin will allow you to choose specific Colour attributes:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Display global groups according to attribute or taxonomy | |
*/ | |
function prefix_filter_global_categories_taxonomy( $args, $group_id, $group, $rule ) { | |
// Return the slug of the taxonomy you wish to use instead of product category | |
return 'pa_colour'; | |
} | |
add_filter( 'pewc_filter_global_categories_taxonomy','prefix_filter_global_categories_taxonomy', 10, 4 ); |
This is how to add the snippet.