How can I add a strikethrough to an old price inside a section template in Shopify?

Hi guys, I want to change the text “19,95 one-time” to “24.95 19,95 one-time”, where 24.95 is shown with a strikethrough as the old price like on the first pic. How can I do this with code? The strikethrough formatting doesn’t work inside the section template I’m using.

mytutor.nl/aanmelden

Hi @User026

Do you want to make changes in this section?

@User026 I think the section you are using is the pricing table, does it have an option to add one more pricing?

Hi Sir,
No we have 2 headers per device. It concerns the phone format.

Hello @User026 Thanks for reaching out to Shopify community with your concern. You got to use CSS property on the price. I have attached the screenshot of how it will look. You might need to add the code for the price first then use this CSS property on the relevant class or ID.

 .price{

text-decoration: line-through;

}

Hi @User026

Do you want to make changes here?

Hi, yes, this is indeed how I want it! I just don’t understand how you added this, see the container attachment

Yes thats correct! I want to make the changes there

@User026

Okay, could you send me the collaborator code? I’ll fix this in your store.

Best regards,
Devcoder :laptop:

I will need collaborator access to implement the same. If you want you can PM and I can guide you and implement it on your store.

In your section template, wrap the old price in a `` tag (or `` if you prefer semantic HTML). Something like:

```html

€24,95 €19,95 one-time

```

If `` gets stripped by the template editor, use a `` with inline style instead:

```html

€24,95 €19,95 one-time

```

If you’re doing this in Liquid and want it dynamic (pulling from compare-at price), you’d use:

```liquid

{% if product.compare_at_price > product.price %}

{{ product.compare_at_price | money }}

{% endif %}

{{ product.price | money }}

```

The compare-at price is what Shopify uses for the “was” price — set it on the product variant in your admin under Pricing.