Skip to main content
Solved

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


Forum|alt.badge.img

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

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 }}

View original
Did this topic or the replies in the thread help you find an answer to your question?

3 replies

Forum|alt.badge.img+5
  • Problem Solver III
  • 59 replies
  • 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:'' }}


Forum|alt.badge.img+7
  • Klaviyo Employee
  • 169 replies
  • Answer
  • July 18, 2024

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

 

Same with {{ event.fulfillment.tracking_url }}


Forum|alt.badge.img+5
  • Problem Solver III
  • 59 replies
  • 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.