Skip to content

Instantly share code, notes, and snippets.

@savchukoleksii
Created June 3, 2019 08:17
Show Gist options
  • Save savchukoleksii/7ee5572e63a92a1f57acfdc7592fc835 to your computer and use it in GitHub Desktop.
Save savchukoleksii/7ee5572e63a92a1f57acfdc7592fc835 to your computer and use it in GitHub Desktop.
{% comment %}
Replace all symbols that not listed in `except_symbols`
{% endcomment %}
{%- assign separator = '%%%' -%}
{%- assign except_symbols = '1234567890.' -%}
{%- assign international_shipping = settings.international_shipping -%}
{%- assign international_shipping_except = except_symbolds | split: '' | uniq | join: separator -%}
{%- assign international_shipping_except = international_shipping_except | split: separator -%}
{%- assign international_shipping_array = settings.international_shipping | split: "" | uniq -%}
{%- for international_shipping_element in international_shipping_array -%}
{%- unless international_shipping_except contains international_shipping_element -%}
{%- assign international_shipping = international_shipping | replace: international_shipping_element, '' -%}
{%- endunless -%}
{%- endfor -%}
{{- international_shipping -}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment