I want to add a custom filter (Stock status filter) to products like this one but it's not working. How to filter product collection with default graphql products query in Magento 2

I used XDebug to see what was happening and used breakpoint in the constructor, it was ok and my breakpoint worked fine, but the apply function is not working. it looks like it's jumping out from my custom filter class.

this is my graphql/di.xml file:

<virtualType name="Magento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\ProductFilterProcessor" type="Magento\Eav\Model\Api\SearchCriteria\CollectionProcessor\FilterProcessor">
    <argument name="customFilters" xsi:type="array">
        <item name="is_in_stock" xsi:type="object">


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.