Hide Sidebar In Woocommerce
-
In woocommerce shop page (archive-product.php) i have listed category instead of product-listing, which list parent category (Shop page display:Show Category),so when i click in parent category im redirect to child-category (Category display: Show sub Category) listing page,lastly when click on child-category im redirect to product listing of child-category,so im trying hide side-bar in parent-category and child category but display side-bar on product listing.
i found that shop-page uses archive-product.php (parent category displaying page) but both child-category and product listing uses taxonomy-product_cat.php so i couldn’t assign different template to for displaying product listing as taxonomy-product_cat.php allow us for using different template (wc_get_template( ‘archive-product.php’ );)
i try to disable side-bar by following code putting it in **archive-product.php**
$prod_categories = get_terms( 'product_cat', array( 'parent' => 0, )); if ($prod_categories) { do_action( 'woocommerce_sidebar' ); }
but does work for child-category
- The topic ‘Hide Sidebar In Woocommerce’ is closed to new replies.