I'm creating a website using the Drupal Commerce module. The module implements a view for the customer's cart at "cart/my", listing all the items the customer added to her/his cart.

The view used to render the item list is "Shopping Cart Form".

I edited this view (well cloned it first) to add an image field owned by the product. In order to get this field in the fields' field list, I first had to create a relation called "(Line items referenced by commerce_line_items) Commerce Line item : Product" for that view. The issue I'm having is that, when the relationship is added (and only then) to get my image field, the view completely breaks when viewed by anonymous or regular authenticated users, and only for these roles. Everything is fine when the cart is viewed by a different role (either a custom role or the administrator role).

I know it sounds crazy, but that's it... Somehow, addind this relation makes the results found for this view to 0 (as shown in the kpr() function run from mytheme_preprocess_views) and only for anonymous and regular authenticated users. If I remove the relation from the view, all goes well again.

Could it be a permission rule somewhere that I skipped ?


what you're experiencing is actually the same as another user whose anonymous users were not able to view their carts. It's related to Views relationships and the automatic access checks they add to Views queries. For more information, please see my answer here:

Anonymous cannot see cart in cart page

  • 1
    Yes!! Thank you very much Ryan!! It perfectly did the trick! – Gaetan Pralong Sep 23 '14 at 11:54

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