Add custom Taxonomies Filter

Filter & Hooks Viewed: 260

If you want to add custom taxonomies to your product variations, you can use the “woocommerce_single_variations_taxonomies” filter. An example how to add the product brand taxonomy can be found here:

/**
 * Add product_brand to taxonomies list for variations.
 *
 * @param array $taxonomies
 *
 * @return array
*/
add_filter( 'woocommerce_single_variations_taxonomies', 'add_custom_taxonomies', 10, 1 );
function add_custom_taxonomies( $taxonomies ) {
   $taxonomies[] = 'product_brand';
   return $taxonomies;
}

After you have placed this function in your child theme functions.php file. Make sure you click on “init” in plugin admin settings again.

Leave a Reply

Your email address will not be published. Required fields are marked *