Edit Sale Price Display - Brooklyn

Solved
shayOwensby
Shopify Expert
169 40 85

@rhs888 mine is doing that by default but to change yours, go to your theme files and go to Assets > theme.scss.liquid. At the bottom of that file, paste the following: (please note that you can use hex values, rgb or $colorPrimary). $colorPrimary will be your themes chosen accent color.

.price.price--listing.price--on-sale span.price-item.price-item--sale {
color: #c40000;
}

.price.price--listing.price--on-sale span.price-item.price-item--sale .price__compare .price-item price-item--regular {
color: #000000;
}

 

Did I provide you with a working solution? Give me an Approved Solution!

Likes are appreciated as well :)
rhs888
New Member
2 0 0

Thanks for the quick response! 

I was able to change the color of the strikethrough price here: 

span.grid-product__strikethrough {
@include accentFontStack;
font-size: em(14px);
color: #FF2D00;
text-decoration: line-through;
}

 

but adding these below it didn't change anything for me 

 

.price.price--listing.price--on-sale span.price-item.price-item--sale {
color: #FF2D00;
}

.price.price--listing.price--on-sale span.price-item.price-item--sale .price__compare .price-item price-item--regular {
color: #000000;
}

 

My theme.scss.liquid bottom section looks like this

 

Screen Shot 2020-11-21 at 4.08.36 PM.png

 

And the outcome is this:

 

Screen Shot 2020-11-21 at 4.09.59 PM.png

0 Likes
reginastudio
Tourist
5 0 3

Late reply but I also had the same bug when using the search bar. (Error message "Liquid error: Unknown operator blank")

Anyone wanting a solution please use my code here as your "product-grid-item.liquid" file instead of original answer or you'll get the same error:

 

 

<!-- /snippets/product-grid-item.liquid -->
{% comment %}

  This snippet is used to showcase each product during the loop,
  'for product in collection.products' in collection.liquid.

  A liquid variable (grid_item_width) is set just before the this
  snippet is included to change the size of the container.
  Once the variable is set on a page, all future instances of this
  snippet will use that width. Overwrite the variable to adjust this.

  Example
    - assign grid_item_width = 'large--one-quarter medium--one-half'

{% endcomment %}

{% unless grid_item_width %}
  {% assign grid_item_width = 'large--one-third medium--one-half' %}
{% endunless %}

{% unless width %}
  {%- assign width = 310 -%}
{% endunless %}
{% unless height %}
  {%- assign height = 415 -%}
{% endunless %}

{% assign on_sale = false %}
{% if product.compare_at_price > product.price %}
  {% assign on_sale = true %}
{% endif %}

{% assign sold_out = true %}
{% if product.available %}
  {% assign sold_out = false %}
{% endif %}

{%- assign variant = product.selected_or_first_available_variant -%}

{% capture img_id_class %}ProductImage-{{ product.featured_media.id }}{% endcapture %}
{% capture img_wrapper_id %}ProductImageWrapper-{{ product.featured_media.id }}{% endcapture %}
{%- assign featured_image = product.featured_media.preview_image %}
{%- assign img_url = featured_image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}

<div class="grid__item grid-product {{ grid_item_width }}{% if sold_out %} is-sold-out{% endif %}">
  <div class="grid-product__wrapper">
    <div class="grid-product__image-wrapper">
      <a class="grid-product__image-link{% unless featured_image.src== blank %} grid-product__image-link--loading{% endunless %}" href="{{ product.url | within: collection }}" data-image-link>
        {% if featured_image.src== blank %}
          <img class="grid-product__image" src="{{ featured_image.src | img_url: '1024x' }}" alt="{{ featured_image.alt | escape }}">
        {% else %}
          {% include 'image-style' with image: featured_image, small_style: true, width: width, height: height, wrapper_id: img_wrapper_id, img_id_class: img_id_class %}
          <div id="{{ img_wrapper_id }}" class="product--wrapper">
            <div style="padding-top:{{ 1 | divided_by: featured_image.aspect_ratio | times: 100 }}%;">
              <img class="product--image lazyload {{ img_id_class }}"
                   data-src="{{ img_url }}"
                   data-widths="[180, 370, 590, 740, 900, 1080, 1296, 1512, 1728, 2048]"
                   data-aspectratio="{{ featured_image.aspect_ratio }}"
                   data-sizes="auto"
                   alt="{{ featured_image.alt | escape }}"
                   data-image>
            </div>
          </div>
          <noscript>
            <img class="grid-product__image" src="{{ featured_image.src | img_url: '1024x' }}" alt="{{ featured_image.alt | escape }}">
          </noscript>
        {% endif %}
      </a>
      {% if sold_out %}
        <div class="grid-product__sold-out">
          <p>{{ 'products.product.sold_out_html' | t }}</p>
        </div>
      {% elsif on_sale %}
        <div class="grid-product__on-sale">
          {% capture saved_amount %}{{ product.compare_at_price | minus: product.price | money_without_trailing_zeros }}{% endcapture %}
          <p>{{ 'products.general.save_html' | t: saved_amount: saved_amount }}</p>
        </div>
      {% endif %}
    </div>

    <a href="{{ product.url | within: collection }}" class="grid-product__meta">
      <span class="grid-product__title">{{ product.title }}</span>
      <span class="grid-product__price-wrap">
        <span class="long-dash">—</span>
        <span class="grid-product__strikethrough">{{ product.compare_at_price | money_without_trailing_zeros }}</span>
        <span class="grid-product__price">
            {{ product.price | money_without_trailing_zeros }}
        </span>

        {%- if product.price_varies == false and variant.available and variant.unit_price_measurement -%}
          {%- capture unit_price_separator -%}
            <span aria-hidden="true">/</span><span class="visually-hidden">&nbsp;{{ 'general.accessibility.unit_price_separator' | t }}&nbsp;</span>
          {%- endcapture -%}

          {%- capture unit_price_base_unit -%}
            <span>
              {%- if variant.unit_price_measurement.reference_value != 1 -%}
                {{- variant.unit_price_measurement.reference_value -}}
              {%- endif -%}
              {{ variant.unit_price_measurement.reference_unit }}
            </span>
          {%- endcapture -%}
          <span class="product-unit-price">
            <span class="visually-hidden">{{ 'products.general.unit_price' | t }}</span>
            <span>{{ variant.unit_price | money }}</span>{{- unit_price_separator -}}{{- unit_price_base_unit -}}
          </span>
        {%- endif -%}
      </span>
      {% if section.settings.product_vendor_enable %}
        <p class="grid-product__vendor">{{ product.vendor }}</p>
      {% endif %}
    </a>
  </div>
</div>

 

 

David555
New Member
2 0 0

Thank you for this! I was able to fix my sale page to have a "strikethrough" design but even with your code I still get the "Liquid Error" when I try to use my search bar. Any other advice to fix this? Much appreciated. 

0 Likes
idlespace
New Member
1 0 0

Hi there I have followed your instructions. But when I copy the Assets code. It marks puts a line through the Lower price not the high marked down original price.

Please help

0 Likes