Collection and Product page price is showing in two line

Collection and Product page price is showing in two line

Sivadarshan
Shopify Partner
53 0 6

Before we are using both compare at price and discount price then it was going good and when we tried to remove the compare at price it got wrong. I have attached the images for both and code too. Guys help with me to get rid of this.

 

After removing the compare at price - product page: 

 

Screenshot 2024-09-14 172406.png

 

After removing the compare at price - collection page: 

 

Screenshot 2024-09-14 172536.png

 

When compare at price at there - collection page: 

 

Screenshot 2024-09-14 172940.png

 

When compare at price was there - Product page: 

 

Screenshot 2024-09-14 173019.png

 

Price.liquid :

{% comment %}
  Renders a list of product's price (regular, sale)

  Accepts:
  - product: {Object} Product Liquid object (optional)
  - placeholder: {Boolean} Renders a placeholder price (optional)
  - use_variant: {Boolean} Renders selected or first variant price instead of overall product pricing (optional)
  - show_badges: {Boolean} Renders 'Sale' and 'Sold Out' tags if the product matches the condition (optional)
  - price_class: {String} Adds a price class to the price element (optional)
  - show_compare_at_price: {Boolean} Renders the compare at price if the product matches the condition (optional)

  Usage:
  {% render 'price', product: product %}
{% endcomment %}
{%- liquid
  if use_variant
    assign target = product.selected_or_first_available_variant
  elsif placeholder
    assign target = null
  else
    assign target = product
  endif

  assign compare_at_price = target.compare_at_price
  assign price = target.price | default: 1999
  assign price_min = product.price_min
  assign price_max = product.price_max
  assign available = target.available | default: false
  assign money_price = price | money
  assign money_price_min = price_min | money
  assign money_price_max = price_max | money
  if settings.currency_code_enabled
    assign money_price = price | money_with_currency
    assign money_price_min = price_min | money_with_currency
    assign money_price_max = price_max | money_with_currency
  endif

  if target == product and product.price_varies
    assign money_price = 'products.product.price.from_price_html' | t: price: money_price
  endif
-%}

{%- unless target == null and placeholder == null -%}
  <div
    class="
      price
      {%- if price_class %} {{ price_class }}{% endif -%}
      {%- if available == false %} price--sold-out{% endif -%}
      {%- if compare_at_price > price and product.quantity_price_breaks_configured? != true %} price--on-sale{% endif -%}
      {%- if compare_at_price > price and product.quantity_price_breaks_configured? %} volume-pricing--sale-badge{% endif -%}
      {%- if product.price_varies == false and product.compare_at_price_varies %} price--no-compare{% endif -%}
      {%- if show_badges %} price--show-badge{% endif -%}
    "
  >
    <div class="price__container">
      {%- comment -%}
        Explanation of description list:
          - div.price__regular: Displayed when there are no variants on sale
          - div.price__sale: Displayed when a variant is a sale
      {%- endcomment -%}
      MRP
      <div class="price__regular">
        {%- if product.quantity_price_breaks_configured? -%}
          {%- if show_compare_at_price and compare_at_price -%}
            {%- unless product.price_varies == false and product.compare_at_price_varies %}
              <span class="visually-hidden visually-hidden--inline">
                {{- 'products.product.price.regular_price' | t -}}
              </span>
              <span>
                <s class="price-item price-item--regular variant-item__old-price">
                  {% if settings.currency_code_enabled %}
                    {{ compare_at_price | money_with_currency }}
                  {% else %}
                    {{ compare_at_price | money }}
                  {% endif %}
                </s>
              </span>
            {%- endunless -%}
          {%- endif -%}
          <span class="visually-hidden visually-hidden--inline">{{ 'products.product.price.regular_price' | t }}</span>
          <span class="price-item price-item--regular">
            {{-
              'products.product.volume_pricing.price_range'
              | t: minimum: money_price_min, maximum: money_price_max
            -}}
          </span>
        {%- else -%}
          <span class="visually-hidden visually-hidden--inline">{{ 'products.product.price.regular_price' | t }}</span>
          <span class="price-item price-item--regular">
            {{ money_price }}
          </span>
        {%- endif -%}
      </div>
      <div class="price__sale">
        {%- unless product.price_varies == false and product.compare_at_price_varies %}
          <span class="visually-hidden visually-hidden--inline">{{ 'products.product.price.regular_price' | t }}</span>
          <span>
            <s class="price-item price-item--regular">
              {% if settings.currency_code_enabled %}
                {{ compare_at_price | money_with_currency }}
              {% else %}
                {{ compare_at_price | money }}
              {% endif %}
            </s>
          </span>
        {%- endunless -%}
        <span class="visually-hidden visually-hidden--inline">{{ 'products.product.price.sale_price' | t }}</span>
        <span class="price-item price-item--sale price-item--last">
          {{ money_price }}
        </span>
      </div>
      <small class="unit-price caption{% if product.selected_or_first_available_variant.unit_price_measurement == nil %} hidden{% endif %}">
        <span class="visually-hidden">{{ 'products.product.price.unit_price' | t }}</span>
        <span class="price-item price-item--last">
          <span>{{- product.selected_or_first_available_variant.unit_price | money -}}</span>
          <span aria-hidden="true">/</span>
          <span class="visually-hidden">&nbsp;{{ 'accessibility.unit_price_separator' | t }}&nbsp;</span>
          <span>
            {%- if product.selected_or_first_available_variant.unit_price_measurement.reference_value != 1 -%}
              {{- product.selected_or_first_available_variant.unit_price_measurement.reference_value -}}
            {%- endif -%}
            {{ product.selected_or_first_available_variant.unit_price_measurement.reference_unit }}
          </span>
        </span>
      </small>
    </div>
    {%- if show_badges -%}


      {%- assign difference = product.selected_or_first_available_variant.compare_at_price | minus: product.selected_or_first_available_variant.price -%}
{%- assign float_difference = difference | times: 1.0 -%}
{%- assign discount_fraction = float_difference | divided_by: product.selected_or_first_available_variant.compare_at_price -%}
{%- assign discount_percentage = discount_fraction | times: 100 | round -%}
      
      <span class="badge price__badge-sale color-{{ settings.sale_badge_color_scheme }}">
        {{- discount_percentage }}% OFF

  {% comment %} {{ 'products.product.on_sale' | t }} {% endcomment %}
      </span>

      <span class="badge price__badge-sold-out color-{{ settings.sold_out_badge_color_scheme }}">
        {{ 'products.product.sold_out' | t }}
      </span>
    {%- endif -%}
  </div>
{% endunless %}
Replies 7 (7)

sakinur-rahman
Shopify Partner
136 17 22

Please send your website link where can view it in frontend.

Need a Shopify developer? Chat on WhatsApp


- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications -

Your Coffee Tip and my code, A perfect blend. ❤️ Buy Me A Coffee


Website: HelloSakin.com
Sivadarshan
Shopify Partner
53 0 6

Sangeetanahar
Explorer
541 36 69

hello @Sivadarshan 

can you send me the Website URL. And what you want in the result is that

thanks

Was I helpful?

Buy me a coffee



Want to modify or custom changes or bug fix on store . Or Need help with your store? Or -Want Complete Storefront
Email me -sangeetarahuldhiman@gmail.com - Skype: live:sangeetarahuldhiman -Whatsapp: +917009811712
Checkout Some Free Sections Here
Sivadarshan
Shopify Partner
53 0 6
Sangeetanahar
Explorer
541 36 69

And what you want in the result is that

Was I helpful?

Buy me a coffee



Want to modify or custom changes or bug fix on store . Or Need help with your store? Or -Want Complete Storefront
Email me -sangeetarahuldhiman@gmail.com - Skype: live:sangeetarahuldhiman -Whatsapp: +917009811712
Checkout Some Free Sections Here
Sivadarshan
Shopify Partner
53 0 6

After removing the compare at price, both the text MRP and the selling price should be in same line

Sangeetanahar
Explorer
541 36 69

hello @Sivadarshan 

Go to online store ----> themes ----> actions ----> edit code ---->assets ----> component-price.css...>

span.price-item.price-item--sale.price-item--last {
    display: block;
}

Underrated-Cotton-Crew-–-KIVOFA.png

Buy me a Pizza


If this was helpful, hit the like button and accept the solution.
Thanks

add the code end of the file

Was I helpful?

Buy me a coffee



Want to modify or custom changes or bug fix on store . Or Need help with your store? Or -Want Complete Storefront
Email me -sangeetarahuldhiman@gmail.com - Skype: live:sangeetarahuldhiman -Whatsapp: +917009811712
Checkout Some Free Sections Here