{%- comment -%}
usage:
{% render 'fn.clickifyPhone', phone: 'string', countrycode: 'integer', anchortxt: 'optionalstring', class: 'optionalstring' %}
{%- endcomment -%}
{%- assign digits = phone | remove: '(' | remove: ')' | remove: '+' | remove: '-' | remove: '.' | remove: ' ' | strip -%}
{%- assign linky = digits | prepend: countrycode | prepend: 'tel:+' -%}
{%- assign test = digits | times: 1 -%}
{%- if test != 0 -%}
{%- if anchortxt != nil and anchortxt != ''-%}{{ anchortxt }}{%- else -%}{{ phone }}{%- endif -%}
{%- else -%}
{{ phone }}
{%- endif -%}
Save as snippets/fn.clickifyPhone.liquid
New(ish) to shopify, so if anyone sees an improvement, please share.