Discussions

Formatting a Product in a View does not show price field

I a little confused about something that I am not sure is a bug, by design, or has a different way to achieve the goal.

I am displaying a Product Display inside a View. In order to display the Product Display as I want it, I need to use Fields instead of the Full Content format.

So I have, as fields, the Product Display's title and body. I also have the referenced Product itself as a field which then allows me to use the "Add to cart form" formatter with a quantity textfield. However, while this show the add to cart button and quantity field, it does not show the price.

If I format the Product Display node in the view as Content: Full Content then the price is visible in the View.

Does anyone know the reason why the price is not injected, along with Add to cart button and quantity textfield, when formatting the Product as a field in a view? If it is possible, how could I get it to show?

Many thanks.

Posted: Dec 12, 2012

Comments

authentictech on December 12, 2012

I got around the problem by adding a 'Content: Rendered Content (The Content of the current relationship rendered using a view mode.)' as a field in addition to the previous field, but this time formatting it as a Rendered Product and using a Custom Display Setting in the View Mode to display only the price field but this does not seem like the correct solution to me.

I feel like the price should be injected with the Add to Cart form and quantity text field as it is when a Product field is rendered as Full Content in the View.

Anyone agree / disagree and why?

Thanks.

authentictech on December 12, 2012

cellar-door, in #drupalcommerce IRC channel said...:

"The price is available but you can't do it on a field basis since it's dependent on the product variations. You can make a relationship to the product and show the price - but when changing variation it won't update the price."

... which makes sense. So it looks like my workaround is the only solution when using fields and the price is only available in the Full Content format.

(I'm only using fields because I don't want the title to be linked as it is in the Full Content format! Perhaps somebody knows a way around that instead?? :-) )

MickC on May 29, 2016

Alternatively you can add the relationship to Views and add a filter to set product delta = 0
Works well if all your options are the same price.
If not you could still make it clear in the product description that price is starting from ... assuming delta 0 is the min price.