Solved

Flow: Access Line Item Properties?

JCAndrea
Shopify Partner
41 2 13

Using Flow, when new orders come in, can we access the Line Item Properties? If so, how?

Thanks!

Accepted Solutions (2)
JCAndrea
Shopify Partner
41 2 13

This is an accepted solution.

I did find resolution in apps such as: Order Tagger, Easy Tagging, Order Automator.

View solution in original post

paul_n
Shopify Staff
850 122 206

This is an accepted solution.

In case anyone comes across this looking for an answer Flow can now access both order properties and line item properties. In the GraphQL API that Flow uses they are called Custom Attributes. Find them at Order / customAttributes and Order / LineItems / customAttributes. 

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 11 (11)

CJWalker
Tourist
10 0 12

Anyone figure this out?

S_Jones_UW
Shopify Expert
42 0 9

Hi @JCAndrea ,

you can access Line Items, it just depends what attribute/property of the line item you are trying to use. Could you clarify if you are you trying to access them for use in your message templates or, to analyse them as part of a condition?

To access line items for use in your conditions, if you create a new Flow, choose Order Created as the trigger and then for the Condition, type "line" into the conditions search box and then scroll down to the Order category where you will find Line Items:

S_Jones_UW_1-1611049154998.png

Once you have selected line items, you'll need to select how you'd like the Condition to match:

S_Jones_UW_2-1611049274583.png

... then you'll be presented with a long list of line item related criteria to select from:

S_Jones_UW_3-1611049345609.png

If none of those suit your needs, could you provide a bit more information about what it is that you're trying to achieve with this Flow please?

 

 

Order and Customer Tagger apps for Shopify
CJWalker
Tourist
10 0 12

Thank you U_Jones_UW, that was a helpful tutorial for accessing the line item object.

What I, and I believe others in this thread are trying to accomplish, is to specifically access order.line_items.properties, which are the custom fields associated with order line items.

You can see what I'm talking about here, about halfway down the page: https://shopify.dev/docs/themes/liquid/reference/objects/line_item

But, it is mysteriously missing from the Flow template variables: https://help.shopify.com/en/manual/shopify-plus/flow/create-workflow/variables


In my case, I use an app called infinite options, that stores custom engraving text in a line_item.properties field. I'm trying to get flow to pull it out and put it in a spreadsheet. No luck so far.

S_Jones_UW
Shopify Expert
42 0 9

Hi @CJWalker @JCAndrea , 

I do apologize, I should have read that one a bit more carefully.

I've not previously seen the ability to analyse the line item properties within Flow, so it does appear to be missing.

You may therefore need to use an app that can analyse the order line item properties first and then apply tags to the order based on a set of conditions that you specify. You could then build your workflow around the presence or absence of those tags.

We operate an app called Order Tagger that has a criteria that can do that, but I'm sure there are other apps and solutions out there that could do something similar. It may be an option you can look into until support for line item properties in Flow is supported.

Sorry for the misunderstanding!

Order and Customer Tagger apps for Shopify
JCAndrea
Shopify Partner
41 2 13

This is an accepted solution.

I did find resolution in apps such as: Order Tagger, Easy Tagging, Order Automator.

RyanFletcher
Shopify Partner
3 0 3

This is a feature I would like to see implemented. Currently I am using Arigato Automation to get the task done (in my case, updating the order note based on order line item custom attributes).

Ideally we would be able to access the order.lineItems.customAttributes object within flow!

petar-sprawsm
New Member
4 0 0

Hi,

 

Shopify flow seems to be missing some of the common attributes within the condition rules. Putting aside the inability to create a rule based on the line item custom attribute, which would be ideal for the case I'm trying to solve, there's nothing that can be used as a substitute.

For example, instead of adding custom attributes to order line items, we could tag the products, or have them be of certain type and use that as a trigger, but the only option there is product title:

line item product options.jpg

 

Is there a plan to add these to the condition building? Any other suggestion (beside adding another app from store) would be very welcome

NicK323
Tourist
3 0 1

@JCAndrea  Search in shopify flow: line item or title and drill down to find this:

 

Title

lineItems_item.title

 

This will target line items in the order including title...

 

Shopify-Plus (17).png

 

paul_n
Shopify Staff
850 122 206

This is an accepted solution.

In case anyone comes across this looking for an answer Flow can now access both order properties and line item properties. In the GraphQL API that Flow uses they are called Custom Attributes. Find them at Order / customAttributes and Order / LineItems / customAttributes. 

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.
ramseyoten
Visitor
1 0 0

Paul Thanks for this information. I am trying to add lineItem properties for each lineItem to an excel sheet in Flow.  My lineitem properties is a list of strings. 
{{lineItemsForeachitem.customAttributes}} variable doesn't output the list. 

It gives an error: The ability to directly output objects is no longer supported. In order to make changes to this workflow, please specify the fields you need to use.
Any insight on this? Thanks

paul_n
Shopify Staff
850 122 206
You need to loop over custom attributes, like:
{% for ca in li.customAttributes %}
{{ ca.key }}-{{ ca.value }}
{% endfor %}

Where li is that for each string.
--
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.