Solved

Dynamic Variables for Billing Address

  • 26 January 2022
  • 4 replies
  • 735 views

Userlevel 2
Badge +6
  • Active Contributor II
  • 19 replies

Dynamic Variables

I am creating a Order Confirmation transactional email, where I am pulling in customer billing address and shipping address via dynamic variables. I can see the information is available in the ‘Preview Info’ under the event properties on a test customer.

  1. All information is pulling through correctly apart from the Billing Address Address1 and Address2 variables which isn't showing at all. 
  2. The billing and and shipping information is duplicating??

     

Variables Metric

Also Can I change the Coupon metric to ‘None’ instead of the current False? And the the Discount sum to ‘0.00’?

 

Many thanks!! 

icon

Best answer by David To 27 January 2022, 16:14

View original

4 replies

Userlevel 7
Badge +60

Hello @MNgo,

Welcome to the Klaviyo Community!

If you haven’t, I would suggest taking a look at our How to Build Dynamic Blocks in a Flow Email (new editor) and How to Insert a Dynamic Image in an Event-Based Flow Email Help Center articles to learn more about utilizing event data to personalize emails!

From your screenshots, I suspect that your billing address 1 and billing address 2 are not accurately being pulled in because you are using the incorrect variables. Typically, the variables you’ll want to use for billing address 1 and billing address 2 are {{ event.extra.BillingAddress.Address1 }} and {{ event.extra.BillingAddress.Address2 }}. or {{ event.extra.billing_address.address1 }} and {{ event.extra.billing_address.address2 }} as opposed to what you have of {{ event.extra.BillingAddress1 }} and {{ event.extra.BillingAddress2 }}.

In regards to the duplication of these variables, I would suggest checking to make sure you are using the Table Data setting of static versus dynamic. Since if looks like you may be trying to create an order confirmation email, these types of data you’re trying to reference of billing and shipping information would not need to be looped through since they are not stored as an array. 

To show or hide your coupon/discount, I would suggest creating an if/else statement for this allow this element to display if it is true, or be hidden if not. If you need further assistance building out your email, I would recommend reaching out to one of our many accredited Klaviyo Partners who often times specialize in email designs as well! 

I hope this helps!

David

Userlevel 2
Badge +6

Thank you so much @David To, the static option has fixed the looping! :raised_hands_tone2:

Are you able to direct me to a guide to create post purchase emails? In particular, where the order has multiple items. Is there a way where I don’t have to copy and create multiple tables for items ordered and defining them separately in each table because of multiple entries e.g. 0, 1, 2 etc. A way where Klaviyo will pull through all items in an order automatically into the email? 

{{ event.extra.Items.0.ProductName }}

{{ event.extra.Items.1.ProductName }}

{{ event.extra.Items.3.ProductName }}

Currency

I’m trying to input currency against my pricing instead of using $currency_code = GBP. I have found a solution on a guide which is {% currency_format item.price %}, however when I input this variable it doesn't work for me. I have set the currency in my account as £, though I’m not sure this even relates to the source of that variable command? 

Userlevel 7
Badge +60

Hey @MNgo,

The How to Build Dynamic Blocks in a Flow Email (new editor) article I previously provided should actually help you with this as it does highlight how you would build a dynamic table block which loops through an array of products automatically. In addition, the How to Build Dynamic Blocks in a Flow Email and Repeating a Block Based on Dynamic Data Help Center articles would be addition resources on this topic.

In regards to your currency, typically that currency_format tag should be pulling in your account’s default currency symbol when paired with the {{ item.price }} variable in a dynamic table block. Alternatively, if you only deal in GBP, you can also simply add in the £ symbol as a static value followed by the price variable to accomplish the same thing. 

David

Userlevel 2
Badge +6

@David To thank you for your help, all sorted now cheers! 

Reply