Product Display Node: Display lowest price for the displays variations

I'm not a big fan of posting questions but I really have exhausted my google search, drupal search, code hacking etc...

I'm not against writing this bit of functionality but it's something I would have thought already existed and I don't want to write it again ;)

As a demo of my problem

My display node is as follows

1. My Super Product
a. large super product - £4
b. small super product - £2
c. extra large super product - £6

Much in the way kickstart does I have a view of rendered entities using the view mode to display the fields. However, I don't see anyway of making the lowest price be displayed. I.e. Prices From £2. It seems to default to the first variation in the list so £4.

Now this works as I can reorganise my variations but when I hand this over I can't trust that people will keep this information up to date.

Am I right in saying this functionality doesn't exist?

Posted: Mar 14, 2013


dottodotdesign on June 15, 2013

Did you find a way to do this? I have a custom node template for my product lists and in that I'd like to display the lowest price not the price from the 1st variation.

T.Mardi on August 8, 2013

Anyone know how to do this?

You can manually drag and drop a production variation to the top of all variations if you have Inline Entity Form installed, but there isn't any sort filters that let you select the lowest priced item to be the default one.

I have 1000's of products so to do this manually for each is out of the question.

dottodotdesign on August 24, 2013

I borrowed so code I found here https://drupal.org/node/1809970 and ended up with the following which seems to work

function my_module_entity_view($entity, $entity_type, $view_mode, $langcode) {
if ($entity_type == 'node' && isset($entity->field_product && $view_mode == 'product_list')) {
$product_ids = $entity->field_product[LANGUAGE_NONE];
$prices = array();
foreach ($product_ids as $delta => $value) {
$product = commerce_product_load($value['product_id']);
foreach ($product->commerce_price[LANGUAGE_NONE] as $item) {
// calculate final prices based on components
$components = array();
$weight = 0;
foreach ($item['data']['components'] as $key => $component) {
$component_type = commerce_price_component_type_load($component['name']);

if (empty($components[$component['name']])) {
$components[$component['name']] = array(
'title' => $component_type['display_title'],
'price' => commerce_price_component_total($item, $component['name']),
'weight' => $component_type['weight'],
$weight = max($weight, $component_type['weight']);

// Add the actual field value to the array.
$components['commerce_price_for_range'] = array(
'price' => $item,
'weight' => $weight + 1,

// Sort the components by weight.
uasort($components, 'drupal_sort_weight');

// Add final prices to an array in order to find the highest and lowest price
foreach ($components as $key => &$component) {
$prices[$component['price']['amount']] = commerce_currency_format($component['price']['amount'],$component['price']['currency_code']);
$sorted = array_values($prices);
$min = $sorted[0];
$entity->content['product:commerce_price_lowest'] = array(
'#markup' => $min,
'#weight' => 10,

baggie on January 10, 2014

hi, did you find a solution? I could really do with this working. Thanks

Brennino on May 11, 2016

Can someone give us a solution? This problem (and is a real, annoying problem...) seems unsolved 3 years after scotthooker post the question!

lennartvv Fernly on January 9, 2024

This is an old issue and surprisingly unsolved in Commerce Core, while this is quite a basic functionality for a web shop in my opinion.
I created the module Commerce From Price to provide this functionality for Drupal 9.4 or higher.

It works via a field formatter that can be applied to the Variations field on product level. It basically displays the variations references as a single lowest price with optional before and after label.