2

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

V1/products?searchCriteria[filter_groups][0][filters][0][field]=category_id&searchCriteria[filter_groups][0][filters][0][value]=:category_id

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.