Using Metafield Delivery Dates & Time Windows

EasyRoutes natively supports delivery dates and time windows added as attributes on orders.  When these values are stored as attributes in a supported format, they'll automatically be processed for use when planning and scheduling routes.  Delivery dates and time windows stored as metafields on orders can also be transferred to attributes via a Shopify Flow automation by following the guide below.

Additional information on working with metafields can be found in this Shopify Help Center article.

What are metafields and how do I create them?

Metafields allow merchants to collect or store additional information for customers, products, orders, and other aspects of their Shopify account that would not otherwise be included as default values or options - for example, the delivery date and time window preferences for a particular order.

Some third-party apps make use of metafields to store custom information on orders or customers, but Shopify users can configure custom metafield behaviour from the Shopify Settings > Metafields and metaobjects tab shown below:

Shopify Settings with Metafields and metaobjects highlighted in the sidebar, and the Metafield definitions list for Products, Orders, Draft orders and more

For example, we'll access the Orders type from the menu above, and click the Add definition button; in the form that appears, we'll configure:

  • Definition pinned (this should be enabled by default)
  • Name: Delivery Date
  • Type: Date
  • Matching draft order definition: Click the + Create draft order definition link here so that this metafield can be configured on draft orders, and will be copied when the draft moves into a "complete" order status (optional if draft orders are not utilized):

Shopify's Add order metafield definition page with Definition pinned, the Name (Delivery Date) and Type (Date) fields, and the Matching draft order definition all outlined

Following the same process as above, we'll configure a second metafield as follows:

  • Definition pinned (this should be enabled by default)
  • Name: Delivery Time
  • Type: Single line text
  • Matching draft order definition: Click the + Create draft order definition link again here (optional if draft orders are not utilized).

Once both definitions are saved, a new Metafields panel will display when viewing any order (or draft order, if enabled) in Shopify where a date calendar picker and time text input box can be configured:

Metafields panel on a Shopify order with a Delivery Time of 8:15 AM - 2:45 PM and a Delivery Date of 31 Mar 2026

Transferring metafields with Shopify Flow

Shopify Flow allows you to create workflows that will run whenever a trigger events occurs - for example, you can structure a Flow as follows to update an order as soon as it is created:

Shopify Flow workflow named Parse Date/Time Metafields to Attributes: an Order created trigger followed by a Send Admin API request step performing the orderUpdate mutation

Notes:

  • The examples below assume that metafield definitions are created to align with the Delivery Date and Delivery Time structure described above.
  • Any other metafields can be transferred to order attributes using the same logic described below, though some custom modifications will be required to suit alternate metafield use cases (particularly custom variable addition for Flow access, and code customization to check for and parse any additional metafields).
  • In order for EasyRoutes to automatically pull delivery date/time window from attributes once transferred, either variable must be in an EasyRoutes-supported format, which can be referenced from the appendix below.

To start, navigate to Shopify Flow, and click the Create template button: on the next page, click the Select a trigger button, before searching for "order created" in the trigger list and selecting the Order created • Shopify option.  

This will create a trigger step on your canvas - hover over this step and click the plus icon that appears below it, then select the Action option:

Shopify Flow's Order created trigger step with the menu below it open and the cursor on Action, beside Condition

Search for "API" in the action list and select the Send Admin API request • Shopify option - you'll be prompted to search for the type of mutation you'd like to perform.  Search for "orderUpdate" and select the matching mutation as shown below:

Shopify Flow's Send Admin API request panel with orderupdate typed in the Select mutation search and the orderUpdate mutation at the top of the results

A default set of variables will populate the Mutation inputs panel.  Before continuing, we'll need to give Flow access to our two metafield values by clicking the Add variable button just above this default input:

Shopify Flow's Send Admin API request panel set to orderUpdate, with an arrow pointing at the Add variable link above the Mutation inputs

In the modal that appears, search for "metafield" and select the order/ metafield option at the top of the list:

Shopify Flow's variable search with metafield typed in and the cursor on the order/ metafield option at the top of the results

From the dropdown, select either of the two metafield options pertaining to delivery date or time, before clicking the Add button:

Shopify Flow's Create variable dialog with the Metafield drop-down open, listing Delivery Date and Delivery Time

Repeat this process again to select the second of the two metafield options - once both have been added, Flow will now have access to each of these variables.  

This can be confirmed by searching "metafield" again from the Add variable menu - both options should now display with live data (green background) for both metafields on the order Flow is using for testing; they will also now be listed as order/deliveryTime and order/deliveryDate as shown below:

Shopify Flow's variable search with arrows pointing at the new order/deliveryTime and order/deliveryDate variables, each showing a test value

Lastly, copy and paste the following code into the Mutation inputs panel, overwriting any existing default inputs:

{
  "input": {
    "id": "{{order.id}}",
    "customAttributes": [
      {% for customAttribute in order.customAttributes %}
      {% unless customAttribute.key == "Delivery Date" or customAttribute.key == "Delivery Time" %}
      {
        "key": "{{customAttribute.key}}",
        "value": "{{customAttribute.value}}"
      },
      {% endunless %}
      {% endfor %}
      {
        "key": "Delivery Date",
        "value": "{{order.deliveryDate.value}}"
      },
      {
        "key": "Delivery Time",
        "value": "{{order.deliveryTime.value}}"
      }
    ]
  }
}

This code does two things:

  • Checks for any other existing attributes on the order, retaining them when the order is updated instead of overwriting them;
  • Copies the date/time metafield values, creating them as Delivery Date and Delivery Time attributes.  If either of these two attributes (with the same name) already exist on the order, they will be overwritten/updated with the new metafield value.

The complete Flow should look like this:

Completed Shopify Flow: an Order created trigger and a Send Admin API request step, with the orderUpdate mutation inputs filled in to set Delivery Date and Delivery Time attributes

From the upper right-hand corner of the page, click into the More actions menu and select Rename to give this Flow a title; click the Turn on workflow button in the same corner before clicking the Turn on confirmation button.

To test the Flow, from the Shopify Orders page, access any order that has both of the metafield values configured.  Access the More actions menu in the upper right-hand corner, and select Run Flow automation before selecting your newly created Flow to run:

Shopify order page with the Metafields panel outlined and the More actions menu open, with an arrow pointing at Run Flow automation

Once the Flow completes running (an Orders page refresh may be required), metafield values should now be displaying within the Additional details panel for the order as attributes:

Shopify order page with an arrow linking the Metafields panel to the Additional details panel, which now shows the same Delivery Date and Delivery Time as attributes

The same order will now also display within EasyRoutes' Orders page with properly configured delivery date and time window values for route planning:

EasyRoutes Orders table row for order #1171 with a Delivery date of 2026-03-28 and a Time window of 10:00 AM - 12:00 PM

Appendix

Supported Time Window Formatting:

EasyRoutes automatically detects time windows on Shopify orders with the following order attribute names/keys:

  • Delivery Time
  • Delivery-Time
  • Order Due Time
  • Selected Time
  • Supertime Timeslot

The following time formats are supported for the attribute value:

Format Examples
12-hour time with minutes

"8:15 AM - 2:45 PM"

"8:15 am - 2:45 pm"

"8:15 AM -"

"8:15 am -"

"- 2:45 PM"

"- 2:45 pm"

12-hour time without minutes

"8 AM - 2 PM"

"8 am - 2 pm"

"8 AM -"

"8 am -"

"- 2 PM"

"- 2 pm"

24-hour time

"8:15 - 14:45"

"8:15 -"

"- 14:45"


Supported Delivery Date Formatting:

EasyRoutes automatically detects delivery dates on Shopify orders with the following order attribute names/keys:

  • Delivery Date
  • Delivery-Date
  • Order Due Date
  • Selected Date
  • Supertime Delivery Date

We recommend using the following universal date format for the attribute value, though we will attempt to use other supported date formats:

Format Examples
YYYY-MM-DD

"2025-02-03"

"2026-11-30"

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.