I add custom filter like “in stock” in category page.
I create plugin afterSetCollection(), beforeSetCollection(), aroundSetCollection().
and create join for get custom field called count which is i get from my custom table.
i use all references but not working.
The in stock product count is show first and out of stock product show at last.
i want to show it like in stock to out of stock sorting .