1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Display global groups according to attribute or taxonomy
  1. Home
  2. Knowledge Base
  3. Groups
  4. Display global groups according to attribute or taxonomy
  1. Home
  2. Knowledge Base
  3. Global Add-Ons
  4. Display global groups according to attribute or taxonomy
  1. Home
  2. Knowledge Base
  3. Product Page
  4. Display global groups according to attribute or taxonomy
  1. Home
  2. Knowledge Base
  3. Conditions
  4. Display global groups according to attribute or taxonomy

Display global groups according to attribute or taxonomy

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:

<?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.

Was this article helpful?

Need More Support?

If you can't find the answer that you're looking for, then please use the link below to raise a support ticket.
Contact Support

Related Articles