Shopify / liquid

Liquid markup language. Safe, customer facing template language for flexible web apps.

Home Page:https://shopify.github.io/liquid/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request: Thousands and decimal separators on cart.currency

nikitaourazbaev opened this issue · comments

It would be great to be able to access the current currency’s thousands and decimals separators on the cart.currency object as currently there is no reliable way of getting them (for an example, see Dawn’s price range filter).

On a related note, it would be great to be able to access these on shop.currency as well, but that object seems to be more limited than cart.currency (for example, it does not have the symbol)

commented

I agree, this would be great. For now, I'm getting the separator this way. It's not ideal and it's definitely gross, but it works for my purposes:

{%- capture money_thousand_separator -%}{{ 100000 | money_without_currency | replace: '1', '' | replace: '0', '' | replace: '0', '' | replace: '0', '' | replace: '0', '' | replace: '0', '' | first }}{%- endcapture -%}

{%- capture money_decimals_separator -%}{{ 100000 | money_without_currency | replace: '1', '' | replace: '0', '' | replace: '0', '' | replace: '0', '' | replace: '0', '' | replace: '0', '' | last }}{%- endcapture -%}