Skip to main content
Contributor I
December 21, 2024
Solved

Updating Tracking Number

  • December 21, 2024
  • 4 replies
  • 203 views

Hello,

I have a problem with my “Order Shipping” flow. Some of my orders have 2 tracking numbers, I want to know how can I get the lastest tracking number. I am using {{ event.extra.fulfillments.0.tracking_number }} but this one only get the first tracking number and not the updated one.
 



I want this event extra to be dynamic, and get the lastest tracking number.

    Best answer by chloe.strange

    Hi ​@Lampera

    To confirm:

    1. You want to track the last value of the tracking_numbers array?
    2. Is there always a tracking_numbers array even if it has one value? or if it has just one value is there only tracking_number (singular)?

    Here are some recommendations:

    You could create something that looks like this: 

    {% if event.extra.fulfillments.0.tracking_numbers %}
    {{ event.extra.fulfillments.0.tracking_numbers|last }}
    {% else %}
    {{ event.extra.fulfillments.0.tracking_number }}
    {% endif %}

    ~Chloe

    4 replies

    chloe.strange
    Community Manager
    Community Manager
    December 24, 2024

    Hi ​@Lampera

    To confirm:

    1. You want to track the last value of the tracking_numbers array?
    2. Is there always a tracking_numbers array even if it has one value? or if it has just one value is there only tracking_number (singular)?

    Here are some recommendations:

    You could create something that looks like this: 

    {% if event.extra.fulfillments.0.tracking_numbers %}
    {{ event.extra.fulfillments.0.tracking_numbers|last }}
    {% else %}
    {{ event.extra.fulfillments.0.tracking_number }}
    {% endif %}

    ~Chloe

    LamperaAuthor
    Contributor I
    December 24, 2024

    Hi ​@Lampera

    To confirm:

    1. You want to track the last value of the tracking_numbers array?
    2. Is there always a tracking_numbers array even if it has one value? or if it has just one value is there only tracking_number (singular)?

    Here are some recommendations:

    You could create something that looks like this: 

    {% if event.extra.fulfillments.0.tracking_numbers %}
    {{ event.extra.fulfillments.0.tracking_numbers|last }}
    {% else %}
    {{ event.extra.fulfillments.0.tracking_number }}
    {% endif %}

    ~Chloe

    Hello Chloe,

    Thanks for helping me out. I fixed my issues, and it was because of the trigger event. But I have another problem now :(

    I completed my order shipment flows (Order confirmation, order shipped, order in progress delivery and order delivered). Problem is, some of my customers profiles have some missing event, some of my profiles don’t have “Marked out for delivery” or “Delivered shipment” event, so they are not in the last 2 flows. And this is an issue if my customer receive their order and are not notified.

     

     

    It is in french but “Colis livré” = “Delivered Shipment”

    chloe.strange
    Community Manager
    Community Manager
    December 26, 2024

    Hi @lampera, 

    I’m going to move this over to a support ticket as it will require more individual troubleshooting. Someone from the support team will be in touch soon.

    ~Chloe

    LamperaAuthor
    Contributor I
    December 26, 2024

    Hi @lampera, 

    I’m going to move this over to a support ticket as it will require more individual troubleshooting. Someone from the support team will be in touch soon.

    ~Chloe

    Thank you Chloe ! The only solution i found for now, is to export Klaviyo templates and change variables to fit Shopify Emails Notifications.