This is regarding the new shopify storefront filters. I have an availability filter set up for the collection, is it possible to give that filter a default value? (preferably from the Shopify admin) so when the page loads “In-Stock” items are preselected?
Hi @sam-uel afaik there’s no setting for preselection in filters and probably never will be*.
There is the new shopify search-and-filter app that may have more control but you would have to investigate.
https://help.shopify.com/en/manual/online-store/search-and-discovery/filters
Currently the easiest ways to solve this is making collection conditions that only include products with stock, then possibly making a counter collection that only contains out of stock products. Because this has the same net effect if you don’t want customers to ever see out-stock items as a default.
Alternatively in navigation menus or anywhere a collection link appears to just append the desired filter parameters to the output links.
*Even as a customization on the frontend this would present a redirection/refresh/rehydrate problem on every single collection a visitor would visit using a pure handle url vs url with filter parameters.
i.e. https://theme-dawn-demo.myshopify.com/collections/shoes vs https://theme-dawn-demo.myshopify.com/collections/shoes?filter.v.availability=1&filter.v.price.gte=&filter.v.price.lte=&sort_by=best-selling
Think like on product pages how the first available variant is selected with the ?variant= parameter that may slow total page load time in some themes as it updates the content to match the new context.
I would like this functionality too.