Project starten

Eigen taxonomieën toevoegen aan Single Variations

Wil je eigen taxonomieën aan je productvarianten toevoegen, dan kun je het filter “woocommerce_single_variations_taxonomies” gebruiken. Een voorbeeld om de taxonomie voor productmerken toe te voegen vind je hier:

/**
 * 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;
}

Nadat je deze functie in het bestand functions.php van je child theme hebt gezet, klik je in de plugininstellingen opnieuw op “init”.