this is my setup: a vocabulary(pulp_toppings) containing 3 terms(honing, noten, brie). Each term also has a price field, I cannot find a way to display the prices of the terms :/ please help.

I have a line item with a term reference but it only references or displays the term titles.

So I could have toppings above my add to cart button but the prices of the toppings won't show.

I followed this tutorial(the screencast from Josh Miller about customizable items) to get the line item and taxonomy part: https://www.youtube.com/watch?v=j9KsyvQZaAY

What I need is either a solution for the above(changing the way my line item references the terms so also the price of the terms are shown) or a better way to handle toppings(not pricing attributes since it stopped working for me).

setup shown below:

taxonomy term display

line item display

view display if needed

add to cart popup


3 Answers 3


If you have token you could 'rewrite output' on the Configure field: screen. I think yours is called 'form' (your 2nd last pic).

On that edit screen scroll down a little and you will see the rewrite output header. In there you can add tokens for fields that are already called earlier in your display. You can call the value and 'exclude from display' just to load them and have them available.

Unfortunately I can't make out the machine names you have assigned to the terms, but there is a button to show you all the available tokens.

Sooo, you could write the output and have <label ...>[..field:?topping_ref:name][..field:?topping_ref:name]</label>


You have to add a relationship to the term being referenced on the content type. Then you'll have access to all of fields available on the terms under your field selection section of the view's configuration form.

EDIT: Since It seems that because in your view you are trying to reference terms from a node that is being referenced from the node that's being displayed, even with grouping and aggregation, it would be difficult to try to create what you want directly in the view. It may be a better option, in your case, to use a view template for the field with the terms.

So it would look something like this (views-view-field--view-display-name--field-machine-name.tpl.php):

// Example code to grab the current field output value
$doc = new DOMDocument();
$raw_val = $doc->getElementsByTagName("div")->item(0)->nodeValue;
// Now load the term programmatically to get the price value
foreach ($row->field_*field_machine_name*[0]['raw']['tid'] as $tid) {
  $term = taxonomy_term_load($tid);
  $price = $term->field_price['und'][0]['value'];

<?php // print $output; ?>
<!--Now reconstruct the output-->
<div class="whatever-wrapper">
  <span class="whatever-name"><?php print $raw_val; ?></span>
  <span class="whatever-price"><?php print $price; ?></span>

Now you may not need to go through the whole process of loading the term, I just showed that as an example. This data may already be available to you in the other variables in the scope of that file which are;

 * Variables available:
 * - $view: The view object
 * - $field: The field handler object that can process the input
 * - $row: The raw SQL result that can be used
 * - $output: The processed output that will normally be used.

Play around with something like that (the file should probably live in your theme's templates directory), and use the Devel module so that you have access to the dpm() function, which will print whatever you put in there on the page in an organized way. I recommend using dpm() on the $view, $field, and $row variables so you can see what you have available to you before trying to load the term programmatically in the template.

You can visit this Drupal docs page for more info on theming single fields in a view.

  • I'm able to get the price by adding a taxonomy term relation, but then it only shows 1 price underneath the 3 checkboxes with terms. May 5, 2015 at 10:45
  • Thanks for the help but it needs a diffrent approach :/ Not sure if it's even possible since the checkboxes are on the line item type and added to the add to cart form. So I'd need to change the way the line item references the terms May 5, 2015 at 11:12
  • @AugusteVanNieuwenhuyzen - Can you provide more information about your view? It looks like it's not showing the line items by default but rather showing data from line items that are referenced by another content type.
    – CR47
    May 5, 2015 at 15:38
  • Thanks for your help but I'm going to use the Pricing Attributes module again it's all I need but it stopped working at one point so I'll just need to fix that to get what I need. Thanks a lot tho May 5, 2015 at 16:16
  • @AugusteVanNieuwenhuyzen - I updated my answer with something that should work for you.
    – CR47
    May 5, 2015 at 18:05

Thanks everyone for the help but I think it will be easier for me to get the Pricing attributes to work again.

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.