Prioritize Out-of-Stock Products in 'Search for a Product' Module"

Hello Community,

Hope you’re all doing well!

In the scenario below, we are watching orders from Website 1 and then searching for the products on Website 2.

We would like to know if it’s possible to configure the “Search for a Product” module to prioritize and return out-of-stock products first, followed by the rest of the products.

Thank you

Hey there,

usually a Search module would return an array of items. You can then sort that array to have the out-of-stock items be the first ones at the beginning of the array.

What module we have to use in order to sort the array?