Skip to main content
Contributor I
July 18, 2024
Solved

Order# and tracking missing from email in my post purchase flow

  • July 18, 2024
  • 3 replies
  • 153 views

Hi all, 

i have created a post purchase flow that it triggered after the order has been fulfilled. 

In the first email I would like to display order number as well as a link so that the customer can check the tracking number. 

 

For fetching the order number I am using : “ The following shipped items from your order #{{ order_number }} “ and for tracking Im using this link for the button : {{ fulfillment.tracking_url }}

 

I created an fulfilled an order on my side and added a tracking number, but when i received the email , there was no order number and the button for tracking was empty. 

 

I though the issue was the fact that the info was not fetch , so I check in the activity details of the specific customer profile and I could see both order # and Tracking Number. 

 

Can someone let me know what I seem to be doing wrong here ? Thanks in advance for taking a look and letting me know 

KR

Nick

    This topic has been closed for replies.
    Best answer by saulblum

    Is order_number an event property? If so, it needs to be {{ event.order_number }}

     

    Same with {{ event.fulfillment.tracking_url }}

    3 replies

    Problem Solver III
    July 18, 2024

    I’m sure that there’ll be a Klaviyo-approved way of accessing the OrderID from the profile’s most recent Placed Order event, and I’d be very interested to learn what that is myself, but I do this by:

    • when a customer orders, I check if they have a klaviyo profile using api/profiles
    • if they do, I save a bunch of custom properties against the profile, including hs_most_recent_order_id (again, api/profiles endpoint)
    • I can then get at their most recent order ID in emails/templates by using {{person.hs_most_recent_order_id}}

    When you despatch an item, you could repeat the process for, ie, person.most_recent_tracking_url

    G

    EDIT: looks like https://developers.klaviyo.com/en/v1-2/docs/django-message-design#event-variables is a solid method for event-triggered flows, if your flow is triggered by a Placed Order event then something like {{ event|lookup:OrderID }} should get you what you want.

    Edit 2: and you can preview (like when normally previewing an email) the data that’ll be available per-user and per-event, then the UI lets you copy the django for it, ie {{ event.OrderId|default:'' }}

    saulblumAnswer
    Klaviyo Employee
    July 18, 2024

    Is order_number an event property? If so, it needs to be {{ event.order_number }}

     

    Same with {{ event.fulfillment.tracking_url }}

    Problem Solver III
    July 18, 2024

    It’s in there as OrderID. Tracking stuff we may not know until the order has been processed, so people will probably have to set up a custom thing for that.