I am trying to add a custom taxonomy to woocommerce, which I did. It is working nicely. However, WordPress is not displaying it as woocommerce category page. Instead, it tries to load it as a regular archive page. Here is my tax registering part:

add_action( 'init', 'custom_taxonomy_Item' );
// Register Custom Taxonomy
function custom_taxonomy_Item()  {
  $labels = array(
      'name'                       => 'Bazes',
      'singular_name'              => 'Baze',
      'menu_name'                  => 'Bazes',
  $args = array(
      'labels'                     => $labels,
      'hierarchical'               => true,
      'public'                     => true,
      'show_ui'                    => true,
      'show_admin_column'          => true,
      'show_in_nav_menus'          => true,
      'show_tagcloud'              => true,
  register_taxonomy( 'bazes', 'product', $args );
  register_taxonomy_for_object_type( 'bazes', 'product' );

I then list the customs tax data as a menu, which links to the tax page (same thing as default wc categories). When I enter the customs tax page, I would like for the content to appear the same way as in default shop category view it appears. Which brings me to the problem. I have no specific template structure, I let WordPress decide which page is wc page and which is wp page. When going to the custom tax page, the system treats it as an archive page, not as wc category page.

Do I need to register the tax as a shop page somewhere?

1 Answer 1


After digging all over the place, it really was as simple as adding theme support. Go figure, just add the following:

//Adding theme support 
function mytheme_add_woocommerce_support() {
    add_theme_support( 'woocommerce' );
    add_theme_support( 'wc-product-gallery-zoom' ); //Only if want woocommerce built in
    add_theme_support( 'wc-product-gallery-lightbox' );//Only if want woocommerce built in
    add_theme_support( 'wc-product-gallery-slider' );//Only if want woocommerce built in
add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );

Worth noting! This will change templates for all woocommerce pages! Meaning built in WordPress templates will be swapped for woocommerce ones. This can result in page designs being broken!

After adding the code you can create file "taxonomy-.php". Now you can start adding you woocommerce stuff. Since most cases means it will be the same as regular categories, then just add following code:

if(is_woocommerce()) {
  wc_get_template( 'archive-product.php' );

Now your custom tax is loading default archive templates, and what changes you make on one will be mirrored on rest. Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.