Compare at price incorrect - help!

Highlighted
Tourist
8 0 3

Our problem is that the 'on sale' price is showing the same as the normal price. The normal price is incorrect, the sale price is correct.

A while back, I edited my code following the advice of an official shopify help post (https://www.shopify.co.uk/partners/blog/collection-page-price-range) to get a price range to show on collection pages.

Could this be why it is showing incorrectly?

I've double checked the compare at price and price in the product pages and they are definitely correct.

The product in question is the 'clearance - reusable face masks' found here.

Any help would be greatly appreciated as we would like to add a 'sale' section but don't want to until it's correctly showing!

Thanks in advance.

0 Likes
Highlighted

Can you show us the snippet of code that's in question? 

0 Likes
Highlighted
Tourist
8 0 3

Thanks for the quick reply Sam. I think this is the code I edited following the above tutorial. I had to change it slightly to make it work for our 'refill' products.

{% if variant.title %}
  {%- assign compare_at_price = variant.compare_at_price -%}
  {%- assign price = variant.price -%}
  {%- assign available = variant.available -%}
{% else %}
  {%- assign compare_at_price = 1999 -%}
  {%- assign price = 1999 -%}
  {%- assign available = true -%}
{% endif %}

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

<dl class="price{% 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 section.settings.show_vendor %}
    <div class="price__vendor">
      <dt>
        <span class="visually-hidden">{{ 'products.product.vendor' | t }}</span>
      </dt>
      <dd>
        {{ product.vendor }}
      </dd>
    </div>
  {% endif %}

  <div class="price__regular">
    <dt>
      <span class="visually-hidden visually-hidden--inline">{{ 'products.product.regular_price' | t }}</span>
    </dt>
    <dd>
      {% if available %}
        {% if product.price_varies and template == 'collection' %}
  From {{ product.price_min | money }} to {{ product.price_max | money }}
                 

  

0 Likes
Highlighted

Thanks for sending that across, can you show me the code for the <div class="price__sale"> 

This below is found on your website.

Screenshot 2020-09-25 154605.png

0 Likes
Highlighted
Tourist
8 0 3

Is this what you mean?

 

<div class="price__sale">
    <dt>
      <span class="visually-hidden visually-hidden--inline">{{ 'products.product.sale_price' | t }}</span>
    </dt>
    <dd>
      <span class="price-item price-item--sale" data-sale-price>
        {{ money_price }}
      </span>
      <span class="price-item__label" aria-hidden="true">{{ 'products.product.on_sale' | t }}</span>
    </dd>
  </div>

That seems all in order, just to double-check you have done this to the product

Screenshot 2020-09-25 160545.png

0 Likes
Highlighted

can you try this for me

{% if available %}
  {% if product.price_varies and template == 'collection' %}
    From {{ product.price_min | money }} to {{ product.price_max | money }} 
{% elsif compare_at_price > price %}
  {{ compare_at_price | money }}
  {% else %}
    {{ money_price }}
  {% endif %}
{% else %}
  {{ 'products.product.sold_out' | t }}
{% endif %}
0 Likes
Highlighted
Tourist
8 0 3

Was I meant to replace some code with that code or add it separately?

Adding it separately almost worked...

Thank you for your help so far, really appreciated

Untitled.png

0 Likes
Highlighted

Replace your existing copy of this code. 

0 Likes
Highlighted
Tourist
8 0 3

Sorry about the slow reply.

Just tried this and while it does change it to the correct pricing, it hasn't got a strikethrough and it also changes the 'refill products' pricing - they used to change depending on variant and with that code they don't.

Does that make sense?

Thanks again for your help.

0 Likes