Solved

Pulling dynamic fields from Shopify JSON into email template

  • 21 July 2023
  • 3 replies
  • 159 views

Badge

We’re creating a personalized email flow for post-purchase where customers receive a “thank you for ordering” email as soon as they complete the purchase. The email will contain…

  1. order line info
  2. delivery date

 

We’d like to pull the delivery date into a dynamic field within the template. Writing {{ event.extra.note_attributes}} returns the below…

[{'name': 'calendar_type', 'value': 'product'}, {'name': 'Date Format', 'value': 'mm/dd/yy'}, {'name': 'product_42275060383907', 'value': 'Dyed Black, Double Shredded Mulch |&| 07/28/2023 |&| Friday'}, {'name': 'Do you have a driveway', 'value': 'yes'}, {'name': 'Dump Location', 'value': 'Top Left'}]

 

We’d like to grab just the delivery date within the following name and value:

'product_42275060383907', 'value': 'Dyed Black, Double Shredded Mulch |&| 07/28/2023 |&| Friday'

 

Is it possible to write syntax to grab this value or should we look for a different approach?

icon

Best answer by stephen.trumble 24 July 2023, 19:29

View original

3 replies

Userlevel 7
Badge +60

Hey @momulch 

Welcome to the community and congrats on your first post!

  • When previewing recent placed order data, there is a "Delivery Date" field is available in a "Note Attributes" section along with other related fields such as "Delivery Time" 
    • ?name=inline7447851.png
  • If you were to copy and paste any of the syntaxes in the preview here and place this into your email, this would then allow that information to dynamically populate for purchasers when they receive the flow. 
  • I'd recommend double checking with Shopify's team that order confirmation emails can be disabled there so you don't have duplicate emails being sent with one confirmation email from each platform.​
  • There are a few videos in the middle of this page which also help with finding preview data to use in flows: https://help.klaviyo.com/hc/en-us/articles/115002779071-About-Using-Event-Variables-to-Personalize-Flows

Hope this helps!

Badge

Thank you @stephen.trumble! That worked.

Do you have any suggestions on syntax to populate just the delivery date from this value? In other words…

  • writing {{ event.extra.note_attributes.2.value }} returns the below…
  • Dyed Black, Double Shredded Mulch |&| 07/28/2023 |&| Friday

What is the suggested syntax to return just 07/28/2023?

Userlevel 7
Badge +44

@momulch what does {{ event.extra.note_attributes.1.value }} return?

 

Regards,

Omar Lovert // Polaris Growth // Klaviyo Master Platinum Partner

We help with e-commerce growth through CRO, Klaviyo and CVO

Reply