# Quick Tip: Display unit price (price per…) in the Prestashop product list

Adding unit prices (also known as “price per…”) to your Prestashop store’s product list is not as easy as it might seem. Prestashop doesn’t assign the unit price in the list; luckily, there is an easy enough workaround

**Version used:**Prestashop 1.5.2**Running time:**5 mins

## Watch the screencast

## Text Version

First of all, if you don’t know exactly what unit prices are, think of a product as a flour sack, a huge one, 5 lbs. Now, the cost is displaying for the whole sack, but in Prestashop you can setup how much that thing costs *per* any measurement you choose (see picture below). In this case, you can display, for example **$2 per lb**

You might want to show this off in the product list, not only in the product page itself. The fact is, however, that Prestashop doesn’t actually assign the **unit price** variable in the product list page. How to deal with it? Let’s have a look: if you print out the product variable in the product list, you’ll notice an interesting property: **$product.unit_price_ratio**

What is this? Basically, it gives you the unit price ratio based on the product’s total price (product price divided by unit price). That’s useful for us, since we can do some math and retrieve the value we need!

Inside the **“foreach from=$products” loop, in the product-list.tpl** file, add the following line. You can add it where you want, just be sure it’s inside the loop, before the unit price you want to print out

{if $product.unit_price_ratio} {math equation="b/a" a=$product.unit_price_ratio b=$product.price_without_reduction assign=realunit} {/if}

**Explanation:** First, we check that there actually is a unit price setup for this product, to prevent “division by zero” ltype errors. Then, we are dividing the product’s final price (without reduction to be more accurate) by the ratio, thus obtaining the real unit price value. If you want the taxless one, use $product.price_tax_exc as parameter b instead.

Let’s print out the final ratio, correctly formatted:

{convertPrice price=$realunit} {l s="per"} {$product.unity}

We are basically formatting the variable so to get the price with currency, adding the “per” string, and, finally, the measurement. That’s it, here is the final code:

{if $product.unit_price_ratio} {math equation="b/a" a=$product.unit_price_ratio b=$product.price_without_reduction assign=realunit} {convertPrice price=$realunit} {l s="per"} {$product.unity} {/if}

Of course, in order for this to show up, **it has to be placed inside the main <li> element, if your list, like in the default theme, is an unordered list**.