Creating A Split Shipment Email

Brian Whalley Updated by Brian Whalley

Using Wonderment's event data, you can build an email that contains details on split shipments (multiple shipments) in one order. You can also set limitations around how often this email will go out, to prevent orders with many shipments from barraging the customer with email.

Accessing Split Shipment Data

This is made possible by Wonderment embedding data on each related shipment in the event body, and using flow logic to regulate how often the email can sends. To work with Split Shipment data in Klaviyo, click the Enable button in Wonderment Integration Settings.

Once you do, several new variables will be added to your Klaviyo data.

Event Data Property Name

Example Data

OtherShipmentsInThisOrder

An array (see below) of other shipments in the order, and their line items

TotalShipments

The total number of fulfillments in this order.

LineItemsFloating

A line items array of any fulfillable products in the order, but not attached to any fulfillments. These are any "yet to ship" products, backordered products, or similar.

OtherShipmentsInThisOrder contains nested arrays with each shipment in an order, the status of that shipment, and the line items array on each shipment.

Event Data Property Name

Example Data

CarrierName

UPS

TrackingCode

9400136109361612633716

CarrierNameFriendly

Australia Post

Status

DELIVERED

Eta

8/15/2022

DeliveredAt

If this shipment was already delivered when the event was generated, the datetime of the delivery event.

LineItems

The line items array for the contents of the fulfillment.

Using Split Shipment Data in a Template

Using split shipment data in an email template is very similar to the normal product loop blocks. There are several templates for split shipment emails available for through Wonderment Support - Message Support and we can copy the templates into your account to help you get started. There are two sections you can add to fully implement split shipment data - line items in related packages, and line items that have not yet shipped.

Linking to a Split Shipment Tracking Page

When working with a Split Shipment tracking email, it is strongly recommended to also use a tracking page layout that supports split shipments. Select a tracking page layout that supports it like List, and then make sure you link to the page using the Order Name, instead of the Tracking Code. If you're using a Wonderment-hosted tracking page, you can do this easily using {{event.WondermentOrderTrackingURL}}, which will automatically send them to the right location. If you're using an App Block or Section for this, just use the {{event.OrderNumber}} variable at the end of your Tracking URL to send them to the right location.

Learn more: Setting Up A Tracking Page For Split Shipments

This piece of the template describes the related shipments. There is a block that contains a nested loop for iterating through each related shipment, and the line items for those shipments, to show their contents and status. This block is relatively complex, this will review each piece of it.

This is a Table Block, with a dynamic data source of shipments, which contains the high-level data on each shipment. Inside of each shipment, we have an additional table that will loop through and present each item in that shipment.

The code inside of Column 1 contains the package status and the line item loop. At the top, the if statements allow you to vary the status message and how the ETA is displayed based on the current status of the package. In this example, you can use messages like the expected date for shipments early in transit, but something more flavorful like "Out for delivery today!" for packages that will be delivered soon.

Below that status message, there is a table that loops through the LineItems array and presents the image, product name, quantity, and price, linked to the product page in the store.

When rendered, this block will look like this:

Including data on items not yet shipped (eg backordered items, items with longer prep time)

The array LineItemsFloating contains information on any fulfillable line items in the order, but not yet on a fulfillment. This is commonly seen with backordered items, or items that require special preparation to ship, or that only ship at certain times.

This array is structured just like the other LineItems arrays.

When rendered, this block will look like this:

Controlling How Often Emails Send

You can control how often a particular type of email sends in Klaviyo through the use of Flow Filters with Delays. Based on the delay associated with a flow, events of a given type like "carrier picked up" or "out for delivery" will bunch up, and then the last one emitted will send out. This is the best behavior, because the last one emitted will contain the most up to date data across your packages.

For example, here are two flows with this filter and delay in place

In this Carrier Picked Up flow, the flow will not send an email until it is likely that all the shipments that will be picked up that day have been picked up - 10 hours has gone by since the last one was picked up. That way, if more than one package is picked up in a 10 hour window, only one email is sent out. If more packages are marked picked up later, another email, up to date with all of the packages, will be sent out.

By adjusting that 10 hour time limit, you can control how often the message will send.

In the example of an Out for Delivery email, you should keep the time window much shorter. Packages are typically only called Out for Delivery early in the morning (often between 5-8 AM local time). Even with a 2 hour wait, the Out for Delivery message will still be delivered early in the day. Also, filter if the package was Delivered in the meantime, so that the Out for Delivery and Delivered messages don't both send.

Timing Recommendations

Our recommendations for delay timing for the major event types:

Event Type

Suggested Delay

Shipment Created

12 hours

Carrier Picked Up

10 hours

Out for Delivery

2 Hours

Delivered

No Delay

Error / Alert Statuses

No Delay

How did we do?

Common Date Formatting In Klaviyo

Integrating Wonderment with Klaviyo

Contact