In my store, i am allowing customers to create products like Courses using Drupal 7 Commerce module, Is there a way using views or whatever method to enable the sellers on my site to see orders placed for their products?

Example: If Stanley is Selling Product1 and Product2, he will be able to see orders for product1 and product2, for now only admin can see the orders.

Your help will be highly appreciated.

  • You can do this in a View with contextual filters and relationships. For an example, check the "my orders" view page, and then do a similar thing for products. Nov 4, 2020 at 8:55
  • Thanks @PatrickKenny This gave me some lights.
    – mrcniceguy
    Nov 6, 2020 at 21:00

1 Answer 1


Yes, you can use Views as Patrick suggests. Make it a View of Order entities with relationships joining Orders to Line Items and Line Items to the referenced Products. You can then apply a contextual filter to only show results whose Product uid matches the currently logged in user's uid.

A couple things to keep in mind...

  1. Such a View would need to "Disable SQL rewriting" in its advanced settings, because it won't work so long as normal entity access control conditions are applied to the query.
  2. You should include in the View itself all the information you need the course seller to see rather than trying to link them directly to a standalone page per Order. If that's what you want, you're going to actually need to hook into the access control system via custom code.
  • 1
    I followed your instructions, i have succeeded, Thank you. I also didnt know about Disabling the "Disable SQL Rewrite" will have such an impact. Are there security Implications?
    – mrcniceguy
    Nov 6, 2020 at 21:01
  • So long as you are filtering the results to only permit users to view data you know they should be able to view, there are no security implications. You're basically disabling the default access control system and using your own filters / contextual filters to manage access manually. Nov 9, 2020 at 2:32
  • Okay Thank you, i appreciate.
    – mrcniceguy
    Nov 10, 2020 at 8:49

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.