Using Flow, when new orders come in, can we access the Line Item Properties? If so, how?
Thanks!
Using Flow, when new orders come in, can we access the Line Item Properties? If so, how?
Thanks!
Anyone figure this out?
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:
Once you have selected line items, youâll need to select how youâd like the Condition to match:
⊠then youâll be presented with a long list of line item related criteria to select from:
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?
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.
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!
I did find resolution in apps such as: Order Tagger, Easy Tagging, Order Automator.
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!
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:
Is there a plan to add these to the condition building? Any other suggestion (beside adding another app from store) would be very welcome
@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âŠ
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 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
Oi paul
VocĂȘ pode disponibilizar um modelo?
Not sure what template you would need, but the liquid part is documented here: https://help.shopify.com/en/manual/shopify-flow/reference/variables#complex-data-objects
Eu criei um fluxo assim:
gatilho: pedido criado
condiçÔes: o pedido é completamente pago e contem uma tag"product-personalizer"
ação: enviar um e-mail interno mostrando cada item do pedido e logo abaixo os itens de linha personalizados, incluindo urls das imagens e anexos.
Mas por algum motivo, o meu fluxo estĂĄ ficando desconfigurado.
Ele mostra os primeiros dados, mas os itens de linha aparecem de forma repetida.
Quero que os itens de linha apareçam embaixo do produto equivalente, pois cada produto possui opçoes de personalização diferentes.
Voce pode me ajudar a ajustar este codigo?
Resumo do pedido:
{% for a in order.lineItems %}
Produto: {{a.title}}
SKU: {{a.sku}}
Preço (por unidade): $ {{a.originalUnitPriceSet.shopMoney.amount}}
Quantidade: {{a.quantity}}
Ătens de Linha:{% for lineItems_item in order.lineItems %}
{% for customAttributes_item in lineItems_item.customAttributes %}
Metafields {% for metafields_item in lineItems_item.product.metafields %}
{{metafields_item.value}}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
Ao final, quero mostrar de forma resumida:
Informaçoes do cliente, incluindo e-mail e telefone
Nome completo
E-mail
Telefone
Endereço de faturamento.
Este Ă© meu primeiro fluxo e eu quero ficar expert neste assunto.
The lineItems appear multiple times because you are looping over lineItems inside of a lineItems loop.
Instead of
Line Items: {% for lineItems_item in order.lineItems %}
{% for customAttributes_item in lineItems_item.customAttributes %}
Metafields {% for metafields_item in lineItems_item.product.metafields %}
{{metafields_item.value}}
{% endfor %}
{% endfor %}
Do
Custom attributes:
{% for customAttributes_item in a.customAttributes %}
Metafields {% for metafields_item in a.product.metafields %}
{{metafields_item.value}}
{% endfor %}
{% endfor %}
Iâll add that looping over metafields is no longer recommended. If you need a metafield value, you should add each individually via the âmetafieldâ (not âmetafieldsâ) variable.
RECEBO UMA MENSAGEM INFORMANDO QUE âaâ Ă© invĂĄlido.:
[image: image.png]
Custom attributes: {% for customAttributes_item in a.customAttributes %}
Metafields {% for metafields_item in a.product.metafields %}
{{metafields_item.value}} {% endfor %} {% endfor %}
Iâm almost there:
Expected result for each product in the order:
Order summary
STEP 1 (LINE ITEM DATA) --------->
Order Summary:
Product: PRODUCT NAME
Option: SELECTED VARIATION
SKU:PRODUCT SKU
Price: PRODUCT PRICE
Quantity: PRODUCT QUANTITY
STEP 2 (SHOW CUSTOM ATTRIBUTES FOR LINE ITEM)
attribute 1: value 1
attribute 2: value 2
attribute 3: value 3
attribute 4: value 4
STEP 3 (METAFIELDS FOR LINE ITEM)
Category: metafield value
Style: metafield value
My code returns all variables correctly, however, in a loop or with âmixedâ data
Iâve tested every possible way.
Please give me a tip on how to renew this code.
I need to keep this information in order, as I showed above, but Iâm not having any luck.
I spent the whole day studying this.
my current code: (returns all data, however, disorganized or in looping)
STEP 1 (LINE ITEM DATA)
Resumo do pedido:
{% for a in order.lineItems %}
{% for lineItems_item in order.lineItems %}
Produto:{{a.title}}
Opção::
{{lineItems_item.variantTitle}}
SKU: {{a.sku}}
Preço $ {{a.originalUnitPriceSet.shopMoney.amount}}
Quantidade: {{a.quantity}}
STEP 2 (SHOW CUSTOM ATTRIBUTES FOR LINE ITEM)
{% for customAttributes_item in lineItems_item.customAttributes %}
{% for customAttributes_item in a.customAttributes %}
STEP 3 (METAFIELDS FOR LINE ITEM)
{% for metafields_item in a.product.metafields %}
{% for value_item in lineItems_item.product.categoriadejaleco.value %}
Categoria: {{value_item}}
{% for lineItems_item in order.lineItems %}
{% for value_item in lineItems_item.product.estilodejaleco.value %}
Estilo: {{value_item}}
{% for lineItems_item in order.lineItems %}
CaracterĂsticas: {{value_item}}
{% for value_item in lineItems_item.product.caracteristicadejaleco.value %}
{{value_item}}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
Iâm almost there:
Expected result for each product in the order:
Order summary
STEP 1 (LINE ITEM DATA) --------->
Order Summary:
Product: PRODUCT NAME
Option: SELECTED VARIATION
SKU:PRODUCT SKU
Price: PRODUCT PRICE
Quantity: PRODUCT QUANTITY
STEP 2 (SHOW CUSTOM ATTRIBUTES FOR LINE ITEM)
attribute 1: value 1
attribute 2: value 2
attribute 3: value 3
attribute 4: value 4
STEP 3 (METAFIELDS FOR LINE ITEM)
Category: metafield value
Style: metafield value
My code returns all variables correctly, however, in a loop or with âmixedâ data
Iâve tested every possible way.
Please give me a tip on how to renew this code.
I need to keep this information in order, as I showed above, but Iâm not having any luck.
I spent the whole day studying this.
my current code: (returns all data, however, disorganized or in looping/repeat data)
STEP 1 (LINE ITEM DATA)
Resumo do pedido:
{% for a in order.lineItems %}
{% for lineItems_item in order.lineItems %}
Produto:{{a.title}}
Opção::
{{lineItems_item.variantTitle}}
SKU: {{a.sku}}
Preço $ {{a.originalUnitPriceSet.shopMoney.amount}}
Quantidade: {{a.quantity}}
STEP 2 (SHOW CUSTOM ATTRIBUTES FOR LINE ITEM)
{% for customAttributes_item in lineItems_item.customAttributes %}
{% for customAttributes_item in a.customAttributes %}
STEP 3 (METAFIELDS FOR LINE ITEM)
{% for metafields_item in a.product.metafields %}
{% for value_item in lineItems_item.product.categoriadejaleco.value %}
Categoria: {{value_item}}
{% for lineItems_item in order.lineItems %}
{% for value_item in lineItems_item.product.estilodejaleco.value %}
Estilo: {{value_item}}
{% for lineItems_item in order.lineItems %}
CaracterĂsticas: {{value_item}}
{% for value_item in lineItems_item.product.caracteristicadejaleco.value %}
{{value_item}}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
This code is not close. You should never be looping over the same list twice. You loop over lineItems about 5-6 times, in nested loops. That would results in hundreds of loops and probably your workflow will hit an API limit if it getâs that far.
I think this will at least run, assuming that your metafield I put in there is named correctly is and is a list of strings. If you add more, make sure they follow that same li.product. format (you might need to delete the order/lineItems loop it inserts). Or just fix up the ones you have already.
**STEP 1 (LINE ITEM DATA)**
**Resumo do pedido:**
{% for li in order.lineItems %}
**Produto:**{{li.title}}
**Opção:**:
{{li.variantTitle}}
**SKU:** {{li.sku}}
**Preço** $ {{li.originalUnitPriceSet.shopMoney.amount}}
**Quantidade:** {{li.quantity}}
**STEP 2 (SHOW CUSTOM ATTRIBUTES FOR LINE ITEM)**
{% for ca in li.customAttributes %}
{{ ca.key }}-{{ ca.value }}
{% endfor %}
**STEP 3 (METAFIELDS FOR LINE ITEM)**
{% for value_item in li.product.caracteristicadejaleco.value %}{{value_item}}{% endfor %}
{% endfor %}