Variables
What are variables?
Variables allow you to store and display values in your template. You can use all of the variables which are available in our Object Reference or create your own.
Using a variable to render its value in a template.
You can use the {{ }}
syntax to render variables in a template. For example, let's say you wanted to display a customer's address in another part of their SMI
{% set shipping_address = address_by_id[order.shipping_address] %}
<div class="og-address-name">
{{ shipping_address.first_name }} {{ shipping_address.last_name }}
</div>
<div class="og-address-line-1">{{ shipping_address.address }}</div>
<div class="og-address-line-2">{{ shipping_address.address2 }}</div>
<div class="og-address-city-state-zip">
{{ shipping_address.city }},
{{ shipping_address.state_province_code }}
{ { shipping_address.zip_postal_code }}
</div>
Updated over 3 years ago
What’s Next