Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Setting up shipping confirmation when more than one courier used

Setting up shipping confirmation when more than one courier used

PaulClarke
New Member
5 0 0

Hi guys,

 

I'm not an expert coder and was hoping someone out there could point me in the right direction. I have a shipping confirmation email that works fine when I only use one courier, but when I use more than one courier for an order it mixes everything up and looks really bad. Currently in this scenario it lists the courier companies first, then lists the tracking numbers, both separated by commas - it looks like below:

 

Courier Company: UPS, FedEx

Tracking number: 123, ABC

 

This is really hard for the customers to untangle.

 

What I'm looking to do is to present each courier separately so it looks like:

 

Courier Company: UPS

Tracking number: 123 

 

Courier Company: FedEx

Tracking number: ABC

 

Can anyone out there help? Any thoughts or suggestions would be really appreciated.

 

I've included my current code below:

 

{% if fulfillment.tracking_numbers.size > 0 %}
<p class="disclaimer__subtext">
{% if fulfillment.tracking_numbers.size == 1 and fulfillment.tracking_company and fulfillment.tracking_url %}
Courier Company: {{ fulfillment.tracking_company }}<br>Tracking number: <a href="{{ fulfillment.tracking_url }}">{{ fulfillment.tracking_numbers.first }}</a>
{% elsif fulfillment.tracking_numbers.size == 1 %}
Tracking number: {{ fulfillment.tracking_numbers.first }}
{% else %}
{{ fulfillment.tracking_company }} tracking numbers:<br />
{% for tracking_number in fulfillment.tracking_numbers %}
{% if fulfillment.tracking_urls[forloop.index0] %}
<a href="{{ fulfillment.tracking_urls[forloop.index0] }}">
{{ tracking_number }}
</a>
{% else %}
{{ tracking_number }}
{% endif %}

Replies 0 (0)