How do I implement this code '{{ product.price | money_without_trailing_zeros }}'

Topic summary

Main issue: implement Shopify Liquid code to format prices like the Hismile store, including removing trailing zeros and adjusting compare-at price display.

  • Requested behavior: use {{ product.price | money_without_trailing_zeros }} and prepend “was” to compare-at prices (e.g., “was $75” or “was $75.50”). Also remove the “AU” currency label from compare-at prices.
  • Technical context: money_without_trailing_zeros is a Shopify Liquid filter that formats currency without .00. Compare-at price refers to the original price shown alongside a discounted price.

What was tried: advised to edit sections → main-product.liquid. The user attempted changes there but reports it didn’t work and the code format is unfamiliar, suggesting additional modification or placement is needed.

Assets: screenshots are central to the desired visual outcome (price styling and currency label behavior).

Status: unresolved. Open questions: precise template/section/snippet to modify, how to prepend “was” to compare_at_price, and how to suppress the “AU” label selectively.

Summarized with AI on January 13. AI used: gpt-5.

I am trying to emulate the following appearance from another Shopify store (the global brand Hismile).

A support advisor pointed me in the direction of this code segment from the Shopify .dev docs, but I have no idea how exactly to implement this.

I would also like to add the string ‘was’ before compare-at-prices storewide, so ‘was $75’, or ‘was $75.50’.

You can see all of this in the image example from hismileteeth.com below.

As you can see, for the compare-at-price it also removes the ‘AU’, unlike in my current set up which you can view below.

Thank you in advance for any help.

I don’t have access to your theme code but this is usually implemented in sections → main-product.liquid

I tried to do this but it didn’t work. Do I need to modify this code in some way, it doesn’t look to be in a format I’ve ever seen.