Search code examples
shopifyshopify-appshopify-template

How do I add the text from a metafield of a product to a metafield on the order in shopify with the Flow App?


What I'm working with:
Shopify with Flow-app.

What I'm trying to do:
Scenario: Customer shops 3 different items and places the order. Now backend viewing the order, I would like to see a metafield with the physical location of the 3 items in the storage to find them quickly.

What I have done so far:
All products has a metafield named: 'Lager Lokation' (this is the storage location). The Namespace and key is: 'custom.lager_lokation'.

For orders I've created the metafieldnamed: 'Order Lager Lokation' (this is string list on the order I want populated with the storage location of each product). The Namespace and key for this is: 'custom.order_lager_lokation'.

What I need help to:
I'm not sure how to fill out these fields and how to write the value that loops through all products metafields for they storage location and adding it to the string list of the order. See image below: enter image description here


Solution

  • You can skip Flow altogether here. A smoother way to do this is as follows:

    • in your product template where you render the product, you certainly have the metafield value holding the location.
    • render that value into the form for the product. Use an input field with the "properties[Location]" attribute.

    Now when the customer buys 3 products from you, the Location value from the metafield shows up in the Order right alongside the line item properties already visible.

    You DO NOT need to mess with Flow.