Oudated & Unnecessary Meta Tag Escaping

Context

Many themes still contain the outdated og:price:amount
& og:price:currcency product meta property tags.

Example Old

<meta 
    property="og:price:amount" 
    content="{{ product.price | money_without_currency | strip_html | escape }}"
>

<meta 
    property="og:price:currency" 
    content="{{ cart.currency.iso_code }}"
>

Example New

<meta
    property = 'product:price:amount'
    content = '{{- product.selected_or_first_available_variant.price | money_without_currency -}}'
/>

<meta
    property = 'product:price:currency'
    content = '{{- shop.currency -}}'
/>

As can be seen in the old example above they usually also contain
the incorrect product.price reference instead of variant.price.

Question

I couldn’t find why or where from the price escaping code came from.

The money_without_currency filter returns a clean decimal value
( XX.XX ) for the price no matter the store’s currency formatting rules.

Why then did they try to strip_html & escape the contents?

Is it just a legacy artifact?

The only thing that money_without_currency doesn’t account for are:

  • Prices from countries where the decimal point is a comma XX,XX / X.XXX,XX
  • Prices larger than 1000XX,XXX.XX

While the resulting formats might technically work , they should be normalized.
XXXX.XX

Hey - thanks for highlighting this. I notice Dawn follows the patterns you described above: dawn/snippets/meta-tags.liquid at d2612f03103a114c965be5291032c847c968350c · Shopify/dawn · GitHub

Have connected with the team who owns this to determine why.

1 Like

Thanks , related to that I had found an unaddressed issue from 2021.

1 Like