How to move out of stock products at the end of results list
- By OCX Team
- In How to ...
- Jun 28, 2020
Since we started to provide TTFB and CRO optimization services, we saw a lot of stores with all kind of issue.
Many of them are easy to fix, but store owners decide to ignore or maybe they are too busy.
Here's one of this issues: showing out of stock products at the top of category page.
Can you see what's wrong in image below?
There's a single product in stock and is at the end of the list.
80% of customers will not even scroll to the bottom.
Now, i'm sure you understand how you lose customers by NOT moving out of stock product at the END of list.
So, let's see how to to move out of stock product to the end of results
- open catalog/model/catalog/product.php
- search area marked in image below
- now make this changes (see image)
* with red = remove;
* with green = was added
Your final code will look like below:
If you want to apply this ONLY for default sort case, do change marked below instead of all changes described above
Some custom themes use a custom made controller to get products. Idea is the same but file location can be other.
If you use Journal, file and location is different: catalog/model/journal3/filter.php
Make changes according to image below:
DO NOT forget to rebuild OCMOD cache and to clear page cache (if you use any page cache extensions)