Tyring to filter Collection page in Shopify with in-stock / OOS stock filter

Hello All, I am currently trying to implement a in-stock / OOS stock filter on our collection page. I see that I might need to create a custom filter using the API. I was going to see if anyone has done this recently or have any alternate routes they are aware of?