Sold out products issue

Can you help me make a change on my site? I sell hats on my site, when customers look at my inventory list tabs, the list starts with hats that are sold out. I’d like to make sold out hats go to the end of the list if possible. Can you help me?

Hey @5ivePanel,

Thanks for posting this to Shopify community. Yes, it’s 100% possible to ensure that sold out items show in the end. By any chance can you please share your store url and password [if applicable] so that I can gave you the answer.
Thanks

Hi, I hit this exact issue with my store a while back and it killed conversions until I fixed it. Sounds like what you describe.
Quick note: if your theme renders each variant as a separate product after load it’s usually a JS/template fallback or the variant picker dumping variants into the product loop. It’s fixable — either by disabling variant rendering in the collection template or deferring the variant expansion via a tiny JS change.

I can post the exact snippet here if you want, or I’ll walk you through the fastest, safe fix I used (saved us from a messy catalog and improved clicks → add-to-cart).

In admin, on the collection page you can change sort order from “Best selling” to, say, “Date, new to old”

It makes sense that best selling items are the one which are sold out.

Also, depending on the way your collections are created, you can either add a condition like “Inventory quantity > 0” for your Automatic collection, or set up a Flow to remove sold out items from manual collections (or move them to the end, if sorted manually).

https://help.shopify.com/en/manual/products/collections/collection-layout#change-the-sort-order-for-the-products-in-a-collection


if my post is helpful, please like it ♡ and mark as a solution -- this will help others find it

my website is www.5ivepanel.com

Thanks for sharing the Store url. By taking a look into it I found that it’s requires the custom code in your theme file. By any chance can you share your store collab code in the p/m so that I can take a look.

Waiting to hear back from you.

Thanks

1. Go to Online Store > Themes > Edit code.

2. Open the file for your collection grid mostly main-collection-product-grid.liquid or collection.liquid under Sections.

3. Please search for the products loop in the code which will be something like below: 

{% for product in collection.products %}

4. Replace the code inside products loop with below:

{% for product in collection.products %}
   {% assign in_stock = collection.products | where: "available", true %}
	{% assign out_stock = collection.products | where: "available", false %}

	{% for product in in_stock %}
	  <!-- product card -->
	{% endfor %}

	{% for product in out_stock %}
	  <!-- product card -->
	{% endfor %}

  {% endfor %}
  
So, by following above products that are available show first, and sold-out automatically move to the end.

It’s true that the default Shopify collection settings are pretty limited! If you don’t want to dig into theme code customization, an app is definitely the way to go. We recommend checking out the SortWise app. We built it specifically for merchants who need that extra level of control to optimize their collections and go way beyond the basics. For instance, it automatically pushes out-of-stock products to the bottom (right out of the box), plus it includes many other powerful features to help you merchandise smarter.

Yea can you let me know how you did it? Right now I was able to get the sold to Bon at the end of the list page. But I can’t get the sold product to just be completed at the end. Meaning the last page of products.

1 Like