Solved

Shopify Flow how to get the order additional details to use into liquid?

vasanth0791
Tourist
11 0 3

in normal order obejct get the additional details use this below liquid code.

for order created attributes "Delivery-Date", "Delivety-Time".

{{ order.attributes["Delivery-Date"] }}
{{ order.attributes["Delivery-Time"] }}

 

How to fetch the Shopify flow liquid to get the attributes.

Can someone help me to resolve this?

Thanks,

Vasanth

 

Shopify Expert | Freelancer
Skype id: vasanth0791 | mail: due07vasanth@gmail.com
Accepted Solution (1)
paul_n
Shopify Staff
1011 133 242

This is an accepted solution.

Hi, thanks I see that error now. I think that is a validation bug in Flow (key passes because that's literally the name of the field). In the interim, depending on which field you are looking to use this information, you could use a loop to get at the attribute like this:

{% for attr in order.customAttributes %}
{% if attr.key == "Delivery-Date" %}
{{ attr.value }}
{% endif %}
{% endfor %}

 I have confirmed that this passes validation, but not that it works. I would love to hear back if it works for you. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.

View solution in original post

Replies 7 (7)

paul_n
Shopify Staff
1011 133 242

The naming follows the GraphQL API, so it's 

{{ order.customAttributes['key'] }}

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
vasanth0791
Tourist
11 0 3

Thanks paul_nuschke.

https://help.shopify.com/en/manual/shopify-plus/flow/create-workflow/variables#order-variables

i am expecting from shopify flow order variables need to fetch the order attributes what exactly fetching in order liquid page. That attributes value i want to get from shopify flow order variables.

investigating shopify flow variable not able to find those attribute variable insider order-variables.

 

Please let me know how to fetch the order attributes in shopify flow liquid variables.

Thanks in advance.

Shopify Expert | Freelancer
Skype id: vasanth0791 | mail: due07vasanth@gmail.com
RyanFletcher
Shopify Partner
3 0 3
{{ order.customAttributes['key'] }}

I've given this a go and the flow seems to accept this however, when changing the actual key name to a given attribute, it rejects it. For example:

{{ order.customAttributes['DeliveryDate'] }}

 

This is rejected by Shopify Flow, throwing an error message claiming that the reference does not exist.

Currently, I am using Arrigato Automation as a solution which does work well however, I thought that Shopify Flow would offer this functionality. Might be a bug but if anyone has any other suggestions, happy to take a look.

Thanks,

Ryan

paul_n
Shopify Staff
1011 133 242

This is an accepted solution.

Hi, thanks I see that error now. I think that is a validation bug in Flow (key passes because that's literally the name of the field). In the interim, depending on which field you are looking to use this information, you could use a loop to get at the attribute like this:

{% for attr in order.customAttributes %}
{% if attr.key == "Delivery-Date" %}
{{ attr.value }}
{% endif %}
{% endfor %}

 I have confirmed that this passes validation, but not that it works. I would love to hear back if it works for you. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
RyanFletcher
Shopify Partner
3 0 3

Hi Paul,

Thanks for your suggestion.

I can confirm that this works as exactly as expected. Just added it to a Shopify Plus Workflow, tested and set live!

Thanks a lot.

AtulGavali
Shopify Partner
2 0 1

Work like charm.

Thank you so much

villepie
Shopify Partner
2 1 4

I would go with something similar to this:

 

{{ order.customAttributes | where: "key", "Delivery-Date" | map: "value" | join: "" }}

 

Why? To avoid unnecessary for loop. This is also a much more simpler to write as oneliner.

Idea is first find correct attribute by key using liquid where filter (https://shopify.dev/api/liquid/filters/array-filters#where) and pick the value. Don't find any other liquid method/filter to return value than map it to new array and then join the found value(s) as string