Product out of stock at the bottom of the page

I’d like to know if there’s any code I can incorporate into my store that allows products that are out of stock to be at the bottom of my collections page, showing my customers the products that are in stock first

For manual collections you can use tools like mechanic to automatically control the sorting

https://tasks.mechanic.dev/move-out-of-stock-products-to-the-end-of-a-collection

https://tasks.mechanic.dev/?q=collection%20sort

For automatic collections not using the manual-sort option, that’s trickier often requiring advanced theme customizations depending on theme.

Or in tandem with setting up such collections conditions to be sorted oldest to newest where products are deleted and recreated so they appear at the end.

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

Sorting either types on the frontend without the support of apps is an advanced theme customization.

If you need this automation setup or customization created for you then contact me directly by mail for services.
Please always provide context, examples: store url, theme name, post url(s) , or any further detail.
Contact Info in signature.