1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Product Page
  5. Conditions
  6. Display global groups according to attribute or taxonomy
  1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Groups
  5. Display global groups according to attribute or taxonomy
  1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Global Add-Ons
  5. Display global groups according to attribute or taxonomy
  1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Product Page
  5. Display global groups according to attribute or taxonomy
  1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  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?

Related Articles