Shopify themes, liquid, logos, and UX
I have filters set through Shopify's Search and Discovery but when a customer clicks through to one of my collections, I would like the Availability filter to be automatically checked and show only the available products. It's fine to leave the checkmark there in case a customer would like to see sold out items and sign up for Back in Stock notifications, but I would like it to start as checked. This should be easy, but I can't seem to find a good answer.
Thank you.
If they are coming from a navigation menu you can control that by using the specific filtered url.
Here one of the impulse demos set to have small variants selected
https://impulse-theme-apparel.myshopify.com/collections/muttonhead?filter.v.option.size=S
Beyond that javascript is required, or deeper advanced customizations
Sample javascript for product availability to use in a custom-liquid section on collection templates:
<script>
document.onreadystatechange = () => {
if (document.readyState === "complete") {
document.querySelector('[name="filter.p.available"]').click()
}
};
</script>
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025