Last active
October 23, 2015 07:20
-
-
Save DanWebb/1c4f22691950da71c146 to your computer and use it in GitHub Desktop.
Get a shops currency symbol with liquid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ 0 | money | remove: '0' | remove: '.' | strip_html }} = '£' or whatever currency your shop is set to | |
<!-- WARNING: the following will not work --> | |
{{ shop.currency }} = the 3 letter currency code i.e. 'GBP' but we want the symbol (£) | |
{{ shop.money_format }} = '£{{amount}}' | |
{{ shop.money_format | remove: '{{amount}}' }} = error because of the curly braces | |
{{ shop.money_format | remove: '{' | remove: 'amount' | remove: '}' }} = error (even a single closing curly brace will error) | |
{{ shop.money_format | slice: 1 }} === 's'? | |
{{ shop.money_format | truncate: 1 }} === '...'? | |
{% capture currency_symbol %}{{ shop.money_format }}{% endcapture %} | |
{{ currency_symbol | slice: 1 }} === 's' | |
{% capture currency_symbol %}{{ shop.money_format }}string{% endcapture %} | |
{{ currency_symbol | slice: 1 }} === 's' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍 Noice!