I am looking into a headless magento approach. I am using the following API to list the products in a given category:


I need to sort these results, so the In-stock products come first, then are followed by the out of stock ones.

I have also managed to add their stock status in extension_attributes as follows:

"extension_attributes": {
            "qty": "Out of Stock"

Any suggestions on how I can achieve this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.