Tagged: shop, show results, Sidebar Menu
Hello,
I have the following problem:
In my shop, I use a sidebar menu for my product categories. I was able to put the sidebar menu to the top of the screen, when on mobile. Now it would be great, if the user can see the results, after selecting a category. Is that possible? At the moment after selecting nothing changes on the screen.
Thank you and kind regards!
Hey christina495,
Thank you for the inquiry.
Looks like you’re using a third-party plugin for the filter. We recommend reaching out to the plugin developer for additional assistance. In the meantime, you could try this script to set it to automaticall scroll to the product section after clicking any of the category items.
add_action( 'wp_footer', function() {
if ( ! function_exists( 'is_woocommerce' ) || ! is_woocommerce() ) return;
?>
<script>
jQuery(document).ready(function($) {
var $products = $('main.template-shop');
if (sessionStorage.getItem('av_scroll_products') && $products.length) {
sessionStorage.removeItem('av_scroll_products');
setTimeout(function() {
$('html, body').animate({ scrollTop: $products.offset().top - 20 }, 400);
}, 200);
}
$(document).on('click', '.sidebar .bellows-target', function(e) {
if (window.innerWidth >= 990) return;
if ($(e.target).closest('.bellows-subtoggle').length) return;
sessionStorage.setItem('av_scroll_products', '1');
});
});
</script>
<?php
}, 20 );
Let us know the result.
Best regards,
Ismael
