Hide Sold Items from Search in Shopify

I am so happy to share this solution.  I have spent many hours and have tried everything I could dream up.  I have followed at least 15 different tutorials/forum articles/help files… nothing worked.  Until today.

Hide Sold Items

In Shopify, we have a lot of different yet similar terminology.  For this, I was searching Google for “hide when inventory = 0” “hide sold items” “only show available” “hide sold out” “hide currently unavailable” etc but sometimes what you are looking for is right before you eyes and is easier than you realize.  The solution below may not work for all themes but it is very general so I believe it will help most.

As always, create a “Duplicate” copy of your theme for your staging area and test this change there before implementing on your live site.

Go to:

Theme > Edit Code > Templates > search.liquid

Find the first line (as seen in the image below) and add the second line directly below it:

Go down to the endfor and add an endif directly before it:

That’s it!  Save and test. If it works, copy the code to your live site.