Following is a collection of useful Liquid snippets, to help with common changes/modifications.

Note: This is intended for advanced users, who are comfortable working with HTML, CSS and Liquid code. It's also a nice reference for myself, when helping customers update templates 😉

Shopify Liquid Documentation

Adding days to a date (example, add XX days to order creation date)

{% assign days_as_seconds = XX | times: 24 | times: 60 | times: 60 %}
{{ created_at | date: "%s" | plus: days_as_seconds | date: "%Y-%m-%d" }}

Replace XX in the above code with the number of days you want to add.

Display line item in one row per quantity (useful in Packing Slips)

{% for i in (1..line_item.quantity) %}

Skip to next line item, if quantity is less than 1.

{% if line_item.quantity < 1 %}{% continue %}{% endif %}

Adding HS Tariff Codes and Country of Origin

{% if line_item.hs_tariff_code != blank %}
<p class="item-description-line">HS Tariff Code: {{ line_item.hs_tariff_code }}</p>
{% endif %}
{% if line_item.country_of_origin != blank %}
<p class="item-description-line">COO: {{ line_item.country_of_origin }}</p>
{% endif %}

Did this answer your question?