Auto sort out of stock products to end of collection?

Hello,

We currently sort our collections by “Best Selling”; however, we would like to automatically sort collections so that out-of-stock products only appear after all in-stock products have been displayed. Is there a way to do this from the vanilla shopify back end? Or will we need a separate app in order to do this?

I was not satisfied by any of the answers in the community so I put this post together showing how to modify the template code to order by stock. I think this should be built into Shopify

https://community.shopify.com/topic/1785852

This “human idea” seems like common sense: “Push out of stock items to the bottom”

However, after trying to make this happen I do indeed see why Shopify has ignored this… with enough community support we could help bring this feature to Shopify’s attention, and with the right DEV team on their end a good solution could be reached by enhancing the Shopify core code and collection array. (further details in link above)

Good luck.