Trying to display price per unit and price per KG. IN NEED OF A CODING SUPERHERO !

Shopify Partner
6 0 0

Hello all,

As you can see on my website, I'm selling cheese - does it ever get more French than that ? - and French laws require vendors to display two prices for the customers to see: the price per unit and the overall price per KG. The idea is for the customer to be instantly informed of the pricing positioning of the vendors by comparing different prices /KG.

Currently, shopify displays the price per unit, and I'm desperate to find out how I can display on the same line the price /KG.

Apparently there are a couple of apps out there, but they are not fit to meet French requirements.

I would worship virtually anybody that can give me a few lines of coding to finally get this thing up and running,


With my everlasting gratitude and baguette,




Shopify Expert
2684 67 778

Hi Christophe, 

There is a Weight field which you can use to store the actual weigth of your item. Then you can simply use something like this: 

{% if current_variant.weight > 0 %}
 <span class=ppu>
 ({{ current_variant.price | divided_by current_variant.weight_in_unit | money }} 
  per {{ current_variant.weight_unit }}) 
{% endif %}

But to update this information with drop-down change you need to also modify the  _updatePrice function in your theme.js.liquid Asset by adding this code: 

var unitPrice = $('.ppu');
if(  unitPrice.length){
  if ( variant.weight > 0 ) {    
    var _ppu = variant.price * 1000 / variant.weight; /* --tim: weight is in grams, need in kilos*/    
   	unitPrice.html('(' + theme.Currency.formatMoney(_ppu, theme.moneyFormat) + ' per kg )').show();

NB! The code was used in another theme (can see it working here), adapted, but not tested in Debut.

Create a backup copy of your theme before making any changes by clicking "Actions" and selecting "Duplicate".

Want to hire me to tweak a theme? Mail me at!
My post solved your problem? Like it!
I am away till Feb-15.
6 0 2

Where exactly do I enter that code?

1 Like
6 0 2

Timur was great help for me. Just talk to him, for a small fee he will write the code for price per kg and apply it to your store for you. He was great help for me.

1 Like
New Member
4 0 0

Really would like your help on something similar for my fruit and veg site

67 0 0

Hi, Dear let's check this  Shopify price per unit app support multiple Product measurement units can be set according to the nature of the product. Variable-sized products based on length, weight, area, volume, and even boxes measured easily. You can sell all kinds of variable-sized products based on their dimensions such as tiles, blinds, liquids, fabric, fencing, frames, wires, liquids, ropes, and many more. Shopify price per unit app enables you to add multiple product stocks.5.jpg