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>
User | RANK |
---|---|
207 | |
178 | |
63 | |
51 | |
47 |
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023