Auto-Tag Orders with Delivery Details from Additional Information on Creation

Auto-Tag Orders with Delivery Details from Additional Information on Creation

draxcode
Shopify Partner
7 0 2

draxcode_0-1747052597008.png

In the Shopify-Admin, each order displays two sections on the right-hand side: "Notes" and "Additional details". The "Additional details" section contains custom fields such as:

  • Delivery Method

  • Delivery Date

  • Delivery Time

These fields are submitted during checkout and stored as order note attributes.

Objective:
When a new order is created, I want to trigger a ShopifyFlow workflow that:

  1. Retrieves the values from the Additional details (i.e., note attributes).

  2. Extracts the Delivery Method, Delivery Date, and Delivery Time.

  3. Automatically applies these values as order tags.   

Can someone help?

Replies 5 (5)

Angelinsmith330
Tourist
5 0 1

Thanks for your message.
We can set it up so that orders are automatically tagged with the delivery details taken from the "Additional Information" section when the order is created. Just let us know if you have any specific format or tagging rules in mind.

draxcode
Shopify Partner
7 0 2

After adding tag it should look something like this : 

 

draxcode_1-1747057200190.png

in Orders : 

draxcode_3-1747057466525.png

 

     

Angelinsmith330
Tourist
5 0 1

Thanks for the clarification!

Yes, once the tag is added, it should reflect in the format you've shown

draxcode
Shopify Partner
7 0 2

So how to do it??

 

James-G
Shopify Partner
29 2 11

Sure, here is how you do it using a Run Code condition to create objects for each of your "Delivery-" order attributes. Once those are created, you just reference those with an Action to add order tags

Screenshot 2025-05-13 at 8.20.06 PM.png

Screenshot 2025-05-13 at 8.24.10 PM.png

Here is the Run Code javascript that I think will work:

export default function main(input) {
  const attributes = input.order.customAttributes || [];
  const deliveryData = {};

  attributes.forEach(attr => {
    if (attr.key && attr.key.startsWith("Delivery-")) {
      const camelKey = attr.key
        .replace("Delivery-", "")
        .replace(/-([a-z])/g, (_, letter) => letter.toUpperCase()); // kebab to camelCase

      const finalKey = "delivery" + camelKey.charAt(0).toUpperCase() + camelKey.slice(1);
      deliveryData[finalKey] = attr.value;
    }
  });

  return deliveryData;
}

 Run Code output should be:

{
  "deliveryMethod": "localDelivery",
  "deliveryDate": "2025-05-09",
  "deliveryTime": "08:00–20:00",
  "deliveryLocation": "Abu Dhabi"
}