WooCommerce how to check if page is_shop() in functions.php?

In WooCommerce, My Category Listing page and product listing page are rendered from archieve-product.php ( By Default) . How to check if page is_shop() in functions.php? As is_shop function does not work in functions.php. I simply want to remove my sidebar from Category listing page not from product listing page.

Related posts

Leave a Reply

4 comments

  1. You can write a condition into “archive-product.php” for category page like,

        $cate = get_queried_object();
        if(is_product_category()  && $cate->parent != 0 ){
    
             // Write code here
             //include sidebar here
        }
    

    By using this code this will check the page for product_category and also check for a parent.