Add text infront of price

New Member
3 0 0

Solution found - See at the bottom of post

 

Hi!

I'm looking to add a custom text infront of all prices (except product pages).

 

I currently have this code in "Snippets -> product-price.liquid".

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

<dl class="price
  {% if available == false %} price--sold-out {% endif %}
  {% if available and compare_at_price > price %} price--on-sale {% endif %}
  {% if available and variant.unit_price_measurement %} price--unit-available {% endif %}"
  data-price
>

  {% if show_vendor and product %}
    <div class="price__vendor">
      <dt>
        <span class="visually-hidden">{{ 'products.product.vendor' | t }}</span>
      </dt>
      <dd>
        {{ product.vendor }}
      </dd>
    </div>
  {% endif %}

  Fra: <div class="price__regular">
    <dt>
      <span class="visually-hidden visually-hidden--inline">{{ 'products.product.regular_price' | t }}</span>
    </dt>
    <dd>
      <span class="price-item price-item--regular" data-regular-price>
        {{ money_price }}
      </span>
    </dd>
  </div>

Notice I've added the "Fra: " which then shows ABOVE the price. I need it to be infront.

How would I go about doing that?

 

Thank you in advance!

 

Solution:

I had to add the "Fra: " text further down in the script before the {{ compare_at_price | money }}.

 

<div class="price__regular">
    <dt>
      <span class="visually-hidden visually-hidden--inline">{{ 'products.product.regular_price' | t }}</span>
    </dt>
    <dd>
      <span class="price-item price-item--regular" data-regular-price>
        Fra: {{ money_price }}
      </span>
    </dd>
  </div>
  <div class="price__sale">
    <dt>
      <span class="visually-hidden visually-hidden--inline">{{ 'products.product.regular_price' | t }}</span>
    </dt>
    <dd>
      <s class="price-item price-item--regular" data-regular-price>
        Fra: {{ compare_at_price | money }}
      </s>
    </dd>

 

 

0 Likes