Using Views with Products in Drupal Commerce

Date Published: 

In Drupal Commerce, the "product" and "product display node" are different things. So to use views of nodes, we have to use a relationship, which is new to some. This screencast shows how to use a Views Relationship to let a view of nodes access information that's on the product.

Views is up to the task of creating a view of product display nodes and getting their information into the view. First, you'll want to create a view of product display nodes, next you'll want to create a relationship (under advanced) to link the product variations to the product display nodes. Finally, save, and there you have it!


alexanansi on December 15, 2012

Hi, I had the same problem and found the documentation not very clear. I got it to work by filtering on Content: Product variations (field_product:delta) = 0. This delta field seems to be a unique ID for each variation, so you just need the first item from the list of variations and that has an ID of 0.

matsjacobsson on December 8, 2012


I'm doing exactly this but the view does not show for anonymous users.

Do I have to tick the "View any product of any type" permission for anonymous to get this to work? I though that was bad for security..

Cheers Mats

jenifer on March 4, 2013

This is driving me really insane... I just can't fathom out how to do this :-(

All I can manage to achieve is to get the images linking through to the admin pages. Is there a tutorial that demonstrates how to do this? Has anyone worked it out?

I've entered my products in the store as well as created new products (via content type > product).

I've been struggling about a week now trying to work out how to create a view of just the images that links through to more details about the product.

Please post and share how to achieve.

jenifer on March 4, 2013

I'm assuming I did this bit right:

-------- Store -----------

Created 4 products

Procuct SKU:

-------- Content type -----------

Create content > Product

Manage fields:

Label: Product reference
Machine name: field_product
Field type: Product reference
Widget: Autocomplete text field

Product types that can be referenced: Product
Product reference field settings: Unlimited

Label: Tags
Machine name: field_tags
Field type: Term reference
Widget: Autocomplete term widget (tagging)

-------- Content -----------

Created 4 content products using create > content > product

Product reference: (autocomplete to select)
Tags: (autocomplete to select)

-------- View display -----------

What I now can't work out is how to create a view:



Each to link to their full content page

All I seem to be doing is going round in a circle and ending up with the image linking to

-------- View settings -----------

Format: Grid

Fields: (Product) Field Image
Relationship: Product
Link image to content

Content title

(Product) Commerce Product: Price
Relationship: Product
Formatter: Formatted amount

Relationship: Content: Referenced product
(Product) Field: Image:fid (Relationship: Product)