Magento – Magento 2 : Add category filter to product grid

categoryfiltermagento-2.1product-grid

I am just trying to add an extra filter of category on the product grid page. After following the method given here – https://chillydraji.wordpress.com/2016/11/29/add-category-filter-to-product-grid-in-magento2/comment-page-1/#comment-626
I can see a new column in my product grid containing categories in it. But from the filter box when i select any category from the dropdown and press apply filter button, an error is coming – "Invalid attribute name: category_id".

Can anyone please let me know what I am doing wrong here.

Best Answer

Changing category_id to category_ids did the trick for me. Cheers!!