You can use the following variables to show the tracking URL in the Order Template.
- shipment.has_tracking_url?: the condition that a shipped order has a tracking URL associated with it.
- shipment.tracking_url: the weblink that allows the customer to track the shipping status of a shipped order.
Here is an example of how you can modify the default Order Template to show the tracking URL:
Default Code
<li><label>Date</label><span>{{ order.date_ordered | date: "%d/%b/%Y"}}</span></li>
{% if order.order_invoice_dates_differ? %}
<li><label>Invoiced</label><span>{{ order.date_invoiced | date: "%d/%b/%Y"}}</span></li>
{% endif %}
{% if order.date_due %}
<li><label>Date Ship By</label><span>{{ order.date_due | date: "%d/%b/%Y"}}</span></li>
{% endif %}
{% endif %}
<li><label>Shipping</label><span>{{ order.shipping_method_name }}</span></li>
{% if order.shipping_days %}
<li><label>Maximum Delivery Days</label><span>{{ order.shipping_days }}</span></li>
{% endif %}
{% if order.shipping_tracking_code %}
<li><label>Tracking Code</label><span>{{ order.shipping_tracking_code }}</span></li>
{% endif %}
Custom Code
Add the code in red to the default code shown above as follows:
<li><label>Date</label><span>{{ order.date_ordered | date: "%d/%b/%Y"}}</span></li>
{% if order.order_invoice_dates_differ? %}
<li><label>Invoiced</label><span>{{ order.date_invoiced | date: "%d/%b/%Y"}}</span></li>
{% endif %}
{% if order.date_due %}
<li><label>Date Ship By</label><span>{{ order.date_due | date: "%d/%b/%Y"}}</span></li>
{% endif %}
{% endif %}
<li><label>Shipping</label><span>{{ order.shipping_method_name }}</span></li>
{% if order.shipping_days %}
<li><label>Maximum Delivery Days</label><span>{{ order.shipping_days }}</span></li>
{% endif %}
{% if order.shipping_tracking_code %}
<li><label>Tracking Code</label><span>{{ order.shipping_tracking_code }}</span></li>
{% endif %}
{% if order.shipping_tracking_url %}
<li><label>Tracking URL</label><span>{{ order.shipping_tracking_url }}</span></li>
Comments
0 comments
Please sign in to leave a comment.