Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
I'm trying to setup a "send internal email" action which includes details of items in a fulfillment order, outputted into a table with columns listing each included variant's order-qty - SKU - variantTitle. I also need to include each variant's value for a particular metafield, but can't get this one to not kick an error. It looks like the metafields variable section has been deprecated in Flow as of January 2023, but I can't figure out the syntax to get even those to work.
Can anyone help me figure out what the value should be to output the value for variant.metafields.inventory.supplier_sku next to the ❗️in the code below? I am getting an error reading: "variant" is invalid. Replace this variable.
<table> <thead> <tr> <th>QTY</th> <th>SKU</th> <th>SKU-SUP</th> <th>ITEM</th> </tr> </thead> <tbody> {% for lineItems_item in fulfillmentOrder.lineItems %} {%- if lineItems_item.requiresShipping == 'true' -%} <tr> <td>{{lineItems_item.remainingQuantity}}</td> <td>{{lineItems_item.sku}}</td> <td>❗️{{lineItems_item.variant.metafields.inventory.supplier_sku}}</td> <td>{{lineItems_item.variantTitle}}</td> </tr> {%- endif -%} {% endfor %} </tbody> </table>
{{lineItems_item.variant.metafields.inventory.supplier_sku}}
The issue isn't the variant but the metafields. You cannot use dot notation in Flow to access metafields yet. Instead, you need to loop over them or use where like this:
{% assign mf = lineItems_item.variant.metafields | where: "namespace","inventory" | where: "key", "supplier_sku" | first %}
{{ mf.value }}
Thanks Paul - I've tried adding that code to the <td> but am still getting the error: "variant" is invalid. Replace this variable.
Oh, I see. The lineItem provided by that trigger is on a fulfillmentOrder and is not the same as the lineItem on the Order. For some reason the "variant" field is deprecated on that lineItem so cannot be used in the workflow. See docs here: https://shopify.dev/docs/api/admin-graphql/2023-04/objects/FulfillmentOrderLineItem
I'm not sure exactly what you need to do here, but you could instead get the lineItems for the whole order by using fulfillmentOrder / order / lineItems / variant.
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025