Add Product Metafield to individual Order Metafields

Hi! I was wondering if the following is possible.

My store has a metafield url under some products. I was hoping to attach the url to individual order metafields if the product they order has an url.

Ex:

Order #1

Product A > product.metafields.url = true > order.metafields.url1 = url
Product B > product.metafields.url = true > order.metafields.url2 = url
Product C > product.metafields.url = false > no order metafield

Product D > product.metafields.url = true > order.metafields.url3 (or even url4 if going by order) = url

would this work if I setup order.metafields.product1 ~ 5? i understand if theres an error for over 5 metafields, but i doubt we would encounter this issue.

I have gotten to the point where i can make it into a list with the order.metafields being defined as a multi-line but i really need the metafield to be defined as an URL in order for me to link it to an app button.

thanks for your help!

1 Like

The method I can think of is to add a metafields to the product page. Then set the product in the theme to add a hidden product attribute. When placing an order, this product attribute will appear under the sku of the product item in the order.

Can easily do this in Flow.

When order is created, loop over lineitems and for each lineitem check if its product has the metafield.

If yes, check the metafields set on the order and set the next available.

You can definitely define metafield as URL (like reference) and on the order you can have a List of URLs.