Reply 187424 to: Subcategories displaying filters

Avatar: denvysb
denvysb
Participant
March 6, 2018 at 19:55

You’ll notice the following code
woocommerce_products_will_display()
on archive-product.php
that determines whether the filter should be shown or not on sub-category page always defaults to “TRUE” regardless if the page should show filters or not.

Old Code


					<?php if ( ( woocommerce_products_will_display() || is_tax( 'brand' ) ) && etheme_get_option( 'top_toolbar' ) ): ?>
	                    <div class="filter-wrap">
	                    	<div class="filter-content">
		                    	<?php
		                    		/**
		                    		 * woocommerce_before_shop_loop hook
		                    		 *
		                    		 * @hooked woocommerce_result_count - 20
		                    		 * @hooked woocommerce_catalog_ordering - 30
		                             * @hooked etheme_grid_list_switcher - 35
		                    		 */
		                    		do_action( 'woocommerce_before_shop_loop' );
		                    	?>
	                    	</div>
	                    </div>
					<?php endif ?>
	                 <?php if (is_active_sidebar( 'shop-filters-sidebar' )): ?>
					<div class="shop-filters widget-columns-<?php echo etheme_get_option( 'filters_columns' ); ?><?php echo (etheme_get_option('filter_opened')) ? ' filters-opened' : ''; ?>">
						<div class="shop-filters-area">
						  	<?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('shop-filters-sidebar')): ?>
							<?php endif; ?>	
						</div>
					</div>
					<?php endif; ?>

New Code


					<?php if ( woocommerce_products_will_display() || etheme_get_option( 'top_toolbar' ) ): ?>
	                    <div class="filter-wrap">
	                    	<div class="filter-content">
		                    	<?php
		                    		/**
		                    		 * woocommerce_before_shop_loop hook
		                    		 *
		                    		 * @hooked woocommerce_result_count - 20
		                    		 * @hooked woocommerce_catalog_ordering - 30
		                             * @hooked etheme_grid_list_switcher - 35
		                    		 */
		                    		do_action( 'woocommerce_before_shop_loop' );
		                    	?>
	                    	</div>
	                    </div>
					<?php endif ?>
	                 <?php if (is_active_sidebar( 'shop-filters-sidebar' )): ?>
					<div class="shop-filters widget-columns-<?php echo etheme_get_option( 'filters_columns' ); ?><?php echo (etheme_get_option('filter_opened')) ? ' filters-opened' : ''; ?>">
						<div class="shop-filters-area">
						  	<?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('shop-filters-sidebar')): ?>
							<?php endif; ?>	
						</div>
					</div>
					<?php endif; ?>
Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.