Shopify themes, liquid, logos, and UX
Hi,
I want to add text after the price on a certain product in the Dawn theme. For example, if the price if £25.00, I want it to say £25.00 Monthly (adding "Monthly") after the price. How would I go about doing that?
Thanks!
You could try adding this on a new line below line 205 in your main-product.liquid file and clicking Save:
<span>monthly</span>
Follow this for:
1. Open snippet->product-price.liquid find below code:
<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>
Now add below code just next to this :
<span class="m_price">Monthly</span>
So it look like:
<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>
<span class="m_price">Monthly</span>
Thank you.
This works but the text is on the line under the price rather than after it on the same line. How can I display this on the same line as the price?
Is there a way to only have it show on one product?
@PobladoCoffi - you probably have this solved now, but if you want to make a change for just one product you can copy 'main-product.liquid' and make changes on the new version 'copy-main-product.liquid.' Then copy the product template and where it says 'main-product.liquid' change to 'copy-main-product.liquid' (or whatever you name it).
Were you able to get text on the same line as price? I can't figure that out - wherever I enter it, it shows on either the line above or the line below? @shamrockshirts @Mr_RaviRaj
main-product.liquid
{%- when 'price' -%}
<div class="no-js-hidden" id="price-{{ section.id }}" role="status" {{ block.shopify_attributes }}>
{%- render 'price',
product: product,
use_variant: true,
show_badges: true,
price_class: 'price--large'
-%}
<span>/ each</span>
</div>
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024