New Shopify Certification now available: Liquid Storefronts for Theme Developers

Is it possible to set default values for shopify filters?

sam-uel
Visitor
1 0 1

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?

Replies 2 (2)
PaulNewton
Shopify Partner
5931 537 1241

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=&...  

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.

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


brickerking
Tourist
10 0 4

I would like this functionality too.