Adding unit prices from scratch

Excursionist
14 1 0

Hey guys, 

i have a problem concerning unitprices which are available in germany and france. 

I think im using a modified district theme and the description of shopify, how to add unitprices, differs from my template (https://help.shopify.com/en/manual/intro-to-shopify/initial-setup/sell-in-germany/price-per-unit)

my product-price.liquid looks like this: 

<!-- snippet/product-price.liquid -->
{% if product.title %}
  {%- assign compare_at_price = product.compare_at_price -%}
  {%- assign price = product.price -%}
  {%- assign price_varies = product.price_varies -%}
  {%- assign available = product.available -%}
{% else %}
  {%- assign compare_at_price = 1999 -%}
  {%- assign price = 1999 -%}
  {%- assign price_varies = false -%}
  {%- assign available = true -%}
{% endif %}

{%- assign money_price = price | money -%}

{% if compare_at_price > price %}
  {% if price_varies %}
    <span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
    <s class="product-price__price">{{ compare_at_price | money }}</s>
    <span class="product-price__price product-price__sale">
      {{ money_price }}
      <span class="product-price__sale-label">{{ 'products.product.on_sale' | t }}</span>
    </span>
  {% else %}
    <span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
    <s class="product-price__price">{{ compare_at_price | money }}</s>
    <span class="product-price__price product-price__sale">
      {{ money_price }}
      <span class="product-price__sale-label">{{ 'products.product.on_sale' | t }}</span>
    </span>
  {% endif %}
{% else %}

  {% if price_varies %}
    <span class="product-price__price">{{ money_price }}</span>
  {% else %}
    <span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
    <span class="product-price__price">{{ money_price }}</span>
  {% endif %}
{% endif %}

{% unless available %}
  <span class="product-price__sold-out">{{ 'products.product.sold_out' | t }}</span>
{% endunless %}

 

How can i access the unit price in the code above? It would be nice if someone could help me to add it with one shot, because i would like to prevent going on downtime during the implementation.  

 

thx in advance

0 Likes