Don't Miss Out! CONCEPT Premium theme - 50% OFF

Okay
  Print

Unit price is compulsory in Germany. If you want to include Unit prices for the product on the product page, please follow instructions below:

  • Go to Editor -> Theme settings -> Multiple Layouts -> Product Page -> Product Page Layout 


  • Go to the Admin -> Edit Code -> Sections / main-product.liquid -> find the corresponding template then click the arrow to go to the file to be changed. Follow the picture below.


  • In the file that needs to be changed, please paste the code below into the end file as shown in the image below:

 <div class="unit-price">

   {% assign current_variant = product.selected_or_first_available_variant %}

   {%- if current_variant.unit_price_measurement -%}

     {{ current_variant.unit_price | money }} <span class="separator">/</span>

       <span>

{%- if

 current_variant.unit_price_measurement.reference_value != 1 -%}

    {{- current_variant.unit_price_measurement.reference_value -}}</span>

   {%- endif -%}                                

    {{ current_variant.unit_price_measurement.reference_unit }}

 {%- endif -%}

 </div>

 

  • Go to the Admin -> Edit Code -> Sections / main-product.liquid -> please paste the code below into file like image.

{% if product.selected_or_first_available_variant != '' %}

   if (variant.unit_price !== 'undefined') {

   var unit = Shopify.formatMoney(variant.unit_price,          

"{{ shop.money_format }}");

var unit_v = variant.unit_price_measurement.reference_value +           variant.unit_price_measurement.reference_unit;

$(".unit-price").html(unit + ' / ' + unit_v); 

    } else {

        $(".unit-price").html('');

    }

{% endif %}

  • Also in Sections / main-product.liquid file, please paste the code below into file like image.

 if( '{{product.selected_or_first_available_variant}}' == ' {{product.selected_or_last_available_variant}} ' ){        

   $('.unit-price').html('{{ product.selected_or_first_available_variant }}');

   $('.unit-price').html('Code');

}