Capitalization of names
In the following snippet, there is no need to include {{name}}
in the body of the email. The snippet below will pull in the first name only of the subscriber.
{% assign nameparts = name | split: ' ' %}
{% capture titlecase %}{% for word in nameparts %}{{ word | downcase | capitalize }}{% endfor %}{% endcapture %}{{ titlecase }}
Display tax in receipt
Display tax in your receipts by subtracting the product price from the payment amount in an email.
{{payment.amount_in_cents | minus: product.price_in_cents | times: 0.001 }}
Replace commas in currency
Swap out commas for periods when needed in international currency usage/
{{ payment.amount | replace:',','.' }}
Display the last 4 digits of a credit card
This syntax will display just the last 4 digits of a card, 1234
, versus the full masked number, XXXX-XXXX-XXXX-1234
{{ payment_profile.masked_card_number | remove: "X"}}
Specify text based on the subscription payment method
This example specifies a set of text to be delivered to a subscriber if they are on an automatic-based payment method, versus an invoice-based payment method. We find this is a great example to be used in receipts!
Dear {{name}}
[Your email content here.]
{% if subscription.payment_collection_method == "automatic" %}
Text for automatic-based subscriber.
{% elsif subscription.payment_collection_method == "invoice" %}
Text for invoice-based subscriber.
{% endif %}
Cheers,
{{merchant_name}}
Specify text based on product
Specify the correct text for your subscribers to receive based on one product, with the rest of the products to receive the same text:
{% if product.handle =="REPLACE" %}
Your content based on the above product handle
{% else %}
[The content you would like to send other subscribers not purchasing the product handle specified above]
{% endif %}
Specify the correct text for your subscribers to receive based on many products:
{% if product.handle =="REPLACE" %}
Your content based on the above product handle
{% elsif product.handle =="OTHER_HANDLE" %}
Your content based on the above product handle
{% elsif product.handle =="OTHER_HANDLE" %}
Your content based on the above product handle
{% else %}
[The content you would like to send other subscribers not purchasing the product handle specified above]
{% endif %}
Specify text based on multiple products
Use the following snippet if you have multiple products and would like to customize the message for each particular product.
{% if product.handle == "[REPLACE_WITH_product_handle]" or product.handle == "[REPLACE_WITH_product_handle]" or product.handle == "[REPLACE_WITH_product_handle]" or product.handle =="[REPLACE_WITH_product_handle]" %}
Here is the text that your subscriber should see if they purchase any of the above products. Be sure to end the if statement below this line.
{% endif %}
Link to a URL
To link to a URL, surround the text with angle brackets:
<https://example.com/my_page>
or<{{subscription.billing_portal_management_url}}>
How to use link references in Liquid
If you would like to locate our website, please click [here][1]
to speak with one of our experts.
[1]: http://www.example.com