String search a collection or remove sold out products from search results.

Tourist
4 0 1

Shopify frustrates me to no end. I get really tired of having to create and hack my way around every single limitation in Shopify. I actually use my 3rd party site to get around a few of those limitations.

The bigger limitations is string search for the site. Why is it that for years and years people have asked to be able to search a collection by string? Why can you not /collection/all?q=hat. Is this so hard? This is way more limiting than /search?q=hat. It is 2017....

Pleas tell me why I can't filter or sort search.results? Why can't I move out of stock products to the back of the results. Why can't I completely remove them from the search results? Is it so hard to add an option "hide out of stock products from search results"? NO! I do not want to update my template to hide unavailable products. This creates empty spots in pages and inconsistent product limits during pagination. (This is a suggestion on this problem every time you google it. This is a poor solution.)

If you could string search a collection then both these problems would be fixed when I add a condition for product to be available.

Additionally, why can't I have the 1000 tag limit on collections increased if A) I am aware of the possible performance issue and B) I would pay for it?

I rather frustrated with shopify's constant limiations. I find that the problems I search for are many years old and very popular problems. Shopify doesn't seem to make the obvious improvements. Instead it seems shopify keeps add more tools for people to build creative hacks. I rather Shopify add some stronger features and controls. Liquid syntax needs some updates.

So my only solution is to constantly remove products so that they don't show up in search results (my company moves a large volume of unique products). This is bad for seo and management.

No, I don't want to upgrade to Shopify Plus. It costs way to much and offers me no benefits. I am still limited by Shopify.

0 Likes
Shopify Expert
9965 84 1469

Why can you not /collection/all?q=hat. Is this so hard? This is way more limiting than /search?q=hat. 

You can do this now by adding some JavaScript to parse the collection. I would not consider using AJAX to pull data sets a hack. If you use an alternate template for the JS to pull from, you can get 1000 items at once.

If you're collections are automated (vs manual) and using tags to determine what products they contain you can use your search query + the tag value. That will work for the standard storefront search. Storefront search will use product tags so adding a tag to a product with their collection is a useful shortcut for searches.

Pleas tell me why I can't filter or sort search.results?

You can. Build it into your theme logic. Not everyone wants it, but if you do - add it. If you're using the JS method than this is a simple addition to the existing code.

Why can't I move out of stock products to the back of the results.

This would be extending that same JS code to reorder the items in the DOM, or the order of the items before they are added to the DOM. Now if you want to stick with the standard storefront search and Liquid - as long as there's 50 or less items you can move the out of stock items to the end right now. This just takes some Liquid edits to search.liquid.

 Why can't I completely remove them from the search results?

You can. Once you're pulling results with JavaScript you've got control to do just that. If the results are less than 50 Liquid logic can handle that now.

This creates empty spots in pages and inconsistent product limits during pagination.

Hence the addition of JS to plug the holes and replace the default pagination with a dynamic one.

Additionally, why can't I have the 1000 tag limit on collections increased if A) I am aware of the possible performance issue and B) I would pay for it?

Platform limitation. There's ways around this but it does require manually setting the list of tags that should show.

No, I don't want to upgrade to Shopify Plus.

Nothing you're talking about here is a Plus feature.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
1 Like
Tourist
4 0 1

Jason, I appreciate the response. You were thorough and went through my entire post. However, none of your solutions work because they are only dom manipulations. I want out of stock products at the VERY end of my collection so that they do not show up at all in the search results. I want pre-filtering to occur so that the dom does not receive these products. I am working with 35k products. I will never have a collection or search with less than 50 products.

You can do this now by adding some JavaScript to parse the collection. I would not consider using AJAX to pull data sets a hack. If you use an alternate template for the JS to pull from, you can get 1000 items at once.

If you're collections are automated (vs manual) and using tags to determine what products they contain you can use your search query + the tag value. That will work for the standard storefront search. Storefront search will use product tags so adding a tag to a product with their collection is a useful shortcut for searches.

I consider many approaches shopify clients have to take as a hack. Using an alternate template than calling that template for products seems like a hack/workaround the shopify limits that they put in place.

That is awesome to know about the search+tag. However, that doesn't fix any of my issues.

My issues:

  • Need collection+search
    • This means that searches are restricted by the collection
    • note: It looks like your query + collection tag idea is pretty good. However, I won't have all the "current tags" since I am not in a collection and I can't build out the filtering.
  • Need complete lists of all "current tags" in the view from the current collection
    • current tag limit is 1000, i can't paginate these
  • Sort collection and search results BEFORE DOM.
    • It seems extremely intuitive that you would want out of strock products at the end of collection or search.results when you have 50+ products. You wouldn't want out of stock products taking up placement on the first few pages.
    • Using DOM manipulation causes many negatives and a jarring experience for the user as product count on page can be weird/funny as I want to hide out of stock products.

I don't see how pulling 1000s of products via alternate template can help me.Are you saying that for search I could pull a few hundred products find the next 50 results that are in stock and display them? They can still use paginate, then I would skip based on page counter? I am going to try a few things to see if I can make it all work better.

My suggestions to shopify:

  • Allow string search of collections
    • /collections/collection_name/tag?q=shirt
  • Allow changing of tag limit
    • Very few people need this, ability to change for perfomace would be nice.
  • Sort collections and search.results
    • {% search.results | sort: 'inventory_total+desc' %} type of thing would be great!

Tag limit is an issue for my company because we use tags for both navigation filter and for fitment information. We sell auto parts. Tagging allows us to idenfity parts that fit the same year, make, model. So parts have a lot of tags because of this. I may be limiting the number of tags per product to help reduce the tag limit issue.

Thanks for the help. If you have any other sugestions please let me know. Sorry if I am all over the place. I am thinking of solutions as I type.

1 Like
Highlighted
Shopify Partner
28 0 9

I really wish collection search was a built-in feature to Shopify—Jason's AJAX solution works, but it's passing a lot of the performance overhead to the user side when this is something that could very easily be done on the backend. Not to mention, the user-side implementation of this is far more complex than a backend implementation would be.

I love Shopify and have been using it for years, but longstanding limitations like this just astound me.

1 Like