hdkingy
February 1, 2024, 11:23pm
1
Hello, we are looking for a code we can add so all filters on the collection pages are open at all times. Currently our theme only allows us to keep the first filter open. I’ve attached a photo to show how it should look, thank you!
Here is a link to the site: https://pondstream.com/collections/pond-fountain-timers
Uhrick
February 2, 2024, 12:39am
2
Hi, HDkingy, I don’t know what theme you are using, but there is this element in the structure of the filters:
the closed ones will have aria-expanded=“false”, you can force that in the code to always be aria-expanded=“true”, such as the following code
Hello @hdkingy
In Shopify Admin, you can go to Edit theme code, open file custom.js and add this code at the bottom
let filters = document.querySelectorAll('.product-facet__filter-item')
filters.forEach(filter => {
filter.querySelector('button').setAttribute('aria-expanded', true)
filter.querySelector('collapsible-content').style.overflow = 'visible'
})
Hope that helps!