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"> <arguments> <argument name="customFilters" xsi:type="array"> <item name="is_in_stock" xsi:type="object"> SZK\ProductGraphQl\Model\Resolver\Products\SearchCriteria\CollectionProcessor\FilterProcessor\StockStatusFilter </item> </argument> </arguments>