Drupal 8 : Add Product SKU as search filter for Orders view of the Commerce module I like to achieve below solution using Drupal configuration instead of code.

The commerce module has been installed for one of our Drupal CMS site. In the admin interface there is an Orders view for the Commerce module. This view basically shows all orders placed by users on the website.

Within this view I like to add Product SKU field as one of the search filter. I noticed SKU field exists in the Product variations table that is child table of the Products table. And Product table is linked to Order Item table. And Order Item is the child table of Orders table. This is something I checked on the MySQL DB database table relations otherwise I don't know how to find our such relationships from Drupal admin interface.

I went to EDIT section for the Orders view. Then clicked on Add button for Advanced >> Relationship but can't find find any product or product variation entity there. So not sure how to achieve the solution of my problem?

Can you please help?

Looking forward to getting your reply.

Thanks - Hitesh
Ok you all most did it !

first in the view  you need to add the "Order item referenced from order_items" relationship 

in your view ->advanced RELATIONSHIPS... 

after this you can then add the "Product variation" relationship.

with the 2 relationships added to the view you can now add the exposed filter you require.