0

I want to hide woocommerce breadcrum in only woocommerce archive page. And i want to display it in single product. So i write this code in functions.php:

if(is_shop()) {
    remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20);
}

But it not hiding.

1

is_shop() is returning false because the WordPress query isn't set up yet when functions.php is run. If you attach it to a hook, like wp_loaded, it should work.

add_action( 'wp_loaded', 'remove_main_content' );
function remove_main_content() {
  if( is_shop() ) {
    remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
  }
}
| improve this answer | |

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