This topic has 7 replies, 2 voices, and was last updated 3 weeks, 3 days ago ago by Andrew Mitchell
Hi,
I’ve added to the shop sidebar widget area:
Widgets of filter products by attribute and active product filters.
I’m showing it in the left sidebar, with ajax and without being sticky.
As I haven’t added the ‘Apply all filters’ widget, this should automatically filter the products once a checkbox has been checked.
I’ve tested it and it worked perfectly.
Then I’ve also added to the Shop filters widget area:
Widgets of filter products by attribute and active product filters.
For this widget area I’ve also added the ‘Apply all filters’ widget.
The shop filters widget area is being displayed above the products and it has its filters button to open the filters list.
I’ve tested it and the filters are being applied and the products being filtered only after the ‘Apply filters’ button is being activated, as this is the intended behavior.
I need to have the filters in both the shop sidebar area and the shop filters area, as on some mobile devices there’s a need to switch between the two depending if the viewport is vertical or landscape.
I will also add display:none to each widget area based on the viewport.
When the filters are being displayed on a sidebar and mainly on a desktop they are expected usually to be applied automatically without clicking an ‘Apply’ button, so this is why I have them there without the apply button.
When the filters are being displayed on mobile, they usually being applied only after activating an ‘Apply’ button, so therefore I have it on the shop filters widget area with an Apply button.
The problem is that once the apply-filters.min.js is present (with the ‘Apply all filters’ widget added to the shop filters widget area), then the filters in the shop sidebar widget area don’t filter automatically anymore, although their function doesn’t suppose to wait for clicking on ‘Apply filters’ button (which they don’t have).
So the filters in one widget area are being affected with the behavior of the other widget area that has the ‘Apply filter’ behavior.
This is a problem as one filters display shouldn’t be affected by a separate one.
I would be thankful if you could please let me know what I can add perhaps to functions.php in order to resolve this.
Generally speaking, I’m guessing a function in apply-filters.min.js should perhaps be conditioned to apply only within the container of the relevant widget area (eg: .main-products-loop) or only if the Apply filters button (.etheme-all-filter) is actually present within the container.
Anything to fix this would be appreciated.
Thank you very much!
Hello, Owen,
Thank you for your clarification. The current behavior of the ‘Apply all filters’ widget is designed as intended.
However, we can offer a customization to make it dependent on the filter zone. To proceed with this, we would require FTP and admin access to your website. Additionally, it will be necessary to disable any caching and CDN services, if applicable.
Best regards,
8Theme’s Team
Thank you, Andrew
I don’t have a setup right now to allow access to the website and I really prefer to make all modifications myself in functions.php.
As this is something that can be checked on any basic xstore installation in your filters files, you think you could please just let me know what I can add to functions.php in order to condition only the filters widget under .main-products-loop to wait for the apply button instead of automatically filtering when a checkbox has been checked?
Perhaps it’s a certain function in ajax-filters.min.js or in another file that can be restricted to a given container. I’d be happy to apply the relevant container class myself if you tell me what function I can add to override the current function that implements the Apply filters behavior to all widget areas once one of the widget areas adds the ‘Apply all filters’ widget.
Thank you very much!
Hi, do you have any update in this issue?
Hello, Owen,
Regarding your inquiry, the necessary changes should indeed be made in the file ajax-filters.min.js
. However, please note that this file is a compilation of several other files that are not included in the final build, and we are not authorized to distribute them.
Alternatively, you may submit your suggestion to our task board at https://www.8theme.com/taskboard/
and our development team will take it into consideration.
As for the modifications you made in the functions.php
file, we hope that these changes were applied to the functions.php
file of the child theme. Otherwise, they will be lost after the theme is updated.
Best regards,
8Theme’s Team
I don’t think this is a suggestion. I think it’s a bug.
If by default woocommerce doesn’t even have an “Apply all filters” widget and the filtering is done automatically once a checkbox is being checked in the shop sidebar for example, and you’ve added an optional Apply filters button that may or may not be added to a widget area, and if we’re choosing to add the Apply filter button to a specific widget area (Shop filters) and that affects a widget area that doesn’t even have an apply filters button (the shop sidebar) and causing it to lose its ability to filter automatically without an Apply filters button then that is a bug that needs to be fixed.
I would appreciate any fix that I can add to the child theme’s functions.php file, or at least pointing me to the problematic code that requires adjustment.
Thank you!
Hello, Owen,
We would like to clarify that we do not consider this a bug, as the filters apply to the entire shop page.
For instance, a user may select a color and brand in the sidebar, while choosing size and price in the filter area. When the “Apply all filters” button is clicked, the filters from both areas should be applied, as the user has selected them. If only the filters from one area were applied, it could cause confusion for the user.
Thank you for your understanding.
Best regards,
8Theme’s Team
You must be logged in to reply to this topic.Log in/Sign up