Need collection filtering accordion header to stay open if one item is selected from it

Solved
Tourist
28 0 1

Hello! This is my first post in the Shopify community forum, though I have been using it for years. I am working on a store using the Pipeline theme and I just finished adding accordion headers that open and close to my client's collection filtering. The way the collection filtering works now is that once you select a filter from under one of the main headers, the page reloads and the main accordion header that contains the filter you selected does not stay open. Therefor, it's difficult for the user to tell which filters they have selected. I want to know if there's a way to add some code so that those headers stay open if an item below has been selected for filtering. The site I'm working on is https://triedequestrian.com. Any and all help/suggestions are welcome. Thank you!

0 Likes

Success.

Shopify Expert
2648 60 643

While it's possible to do in liquid, one needs to see the source code of the theme for this.

However, you can use Javascript too -- put this code at the very bottom of theme.js

$( function(){ $('.sidebar__item--active').parent().prev().click(); } );
Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
0 Likes
Tourist
28 0 1

Awesome, this worked perfectly. Thank you!

0 Likes
New Member
8 0 0

Hi,

 

Can you please tell me how you have done this filter for the category. Can you please provide me the code or any reference to do this.

0 Likes