Tell us what you are trying to do?
I want the Custom Search Reset to make a full reset also when the search on the shop page is opened as a product category URL from the home page or the menu and not directly from the shop page search.
Is there any documentation that you are following?
no
Is there a similar example that we can see?
Screencast: hidden link
What is the link to your site?
hidden link
Hello and thank you for contacting Toolset support.
If I understood well, you want the reset button on the category archive to reset the category dropdown and display all the categories instead of one, right?
That's not possible. Because a category filter cannot be used inside a category archive. If it is used, it will always display the selected category only.
I'll suggest one of the following:
- Either remove the category filter from the category archive.
- Or, ad some custom Javascript code that will redirect to the shop page when the reset button is clicked.
Let me know if you need help with either of them.
Thank you, Jamal, since the Product Category filter is essential, the second option seems best in my case (- Or, ad some custom Javascript code that will redirect to the shop page when the reset button is clicked.).
I'm not good with Java, and appreciate your help with that.
Add the following code to the archive's Javascript section and it should redirect to the shop page when the reset is clicked on a category archive page:
jQuery(function($){
if ( /https:\/\/aroga.eu\/product-category\//.test(window.location.href) ) {
$('.js-wpv-reset-trigger').on('click',function(ev){
ev.preventDefault();
ev.stopPropagation();
window.location.assign('<em><u>hidden link</u></em>');
});
}
})
If that does not help, or you have any doubts on how to implement it, allow me temporary access to your website as an administrator and I'll help with it. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
Apparently, the Javascript code was stripped by the archive template and caused errors. I updated the code a bit to make it work. The current code is:
jQuery(function($){
if ( /product-category/.test(window.location.href) ) {
$('.js-wpv-reset-trigger').on('click',function(ev){
ev.preventDefault();
ev.stopPropagation();
window.location.assign('<em><u>hidden link</u></em>');
});
}
});
Please check if that achieves what would you expect, or if there is something I have missed.
My issue is resolved now. Thank you, Jamal! You helped a lot! I'm promoting this search option as unique for my niche and, therefore, this was very important for my business.
Cheers,
Göran
Thank you Göran for your feedback. I am glad I could help.
All the best,
Jamal