How can I add MULTIPLE tracking numberS and URLs per liquid on the customers/account.liquid

Hi,

On the orders pages, I have , for exemple, an order /admin/orders/############.json with 3 tracking links :

/* etc... */
"fulfillments": [
{
	"id":/* etc... */
         /* etc... */
	"tracking_company": "canadapost",
	"tracking_number": "1972400000000010",
	"tracking_numbers": [
		"1972400000000010",
		"1972400000000019",
		"1972400000000023"
	],
	"tracking_url": "https:\/\/www.fedex.com\/fedextrack\/?trknbr=1972400000000010",
	"tracking_urls": [
		"https:\/\/www.fedex.com\/fedextrack\/?trknbr=1972400000000010",
		"https:\/\/www.fedex.com\/fedextrack\/?trknbr=1972400000000019",
		"https:\/\/www.fedex.com\/fedextrack\/?trknbr=1972400000000023"
	],

I have into the customers/account.liquid


  {% for line_item in order.line_items %}
	{% if line_item.fulfillment.tracking_number %}
		{{ line_item.fulfillment.tracking_company }} #{{ line_item.fulfillment.tracking_number}}

	
  {% else%}
		N/A
	{% endif %}
	{% endfor %}

When the customer consults his “Customer Account” page he can see 3 sames number : it is a first number on the tracking_numbers 1972400000000010
like that :

FedEx#1972400000000010
FedEx#1972400000000010
FedEx#1972400000000010

How I can change it like this :

FedEx#1972400000000010
FedEx#1972400000000019
FedEx#1972400000000023

Could you help me, please

no solution ? can’t you help me? good weekend

Hi,
I’ve been stuck on this issue for 3 days.
There are someone who can me help ?
Nobody have a same problem which he it resould

Your code says

if 'tracking_number' then write 'tracking_url' value 3 times...

Try:

{% if line_item.fulfillment.tracking_numbers.size == 1 and line_item.fulfillment.tracking_company and line_item.fulfillment.tracking_url %}
      {{ line_item.fulfillment.tracking_company }} tracking number: {{ line_item.fulfillment.tracking_numbers.first }}
    {% elsif line_item.fulfillment.tracking_numbers.size == 1 %}
      Tracking number: {{ line_item.fulfillment.tracking_numbers.first }}
    {% else %}
      Tracking numbers (if you want):

      {% for tracking_number in line_item.fulfillment.tracking_numbers %}
        {{ tracking_number }}

      {% endfor %}
      Tracking URLs (what you really want):

      {% assign idx = 0 %}
      {% for tracking_url in line_item.fulfillment.tracking_urls %}
        {{ line_item.fulfillment.tracking_numbers[idx] }}

        {% assign idx = idx | plus: 1 %}
      {% endfor %}
    {% endif %}
  

{% endif %}

~ from https://(store).myshopify.com/admin/email_templates/shipping_update/edit

(note: not fully tested, so let me know if this needs an update :wink:

1 Like