How to access the value of a field key inside a metaobject on a product in an order?

lindahlcorp
Shopify Partner
4 0 1

Okay, I've been trying and logging but can't get the syntax right for this: 

 

I'm trying to access the value of a field inside a metaobject I've attached to products. It is a boolean value.

 

Namespace: product_preorder

Field: 

Key:product_preorder.enabled
 
lindahlcorp_1-1710866546808.png

 

 
lindahlcorp_0-1710866522151.png

 

Here's my flow code with a trigger of new order:
lindahlcorp_2-1710866598508.png

 

How do I access the value of the "enabled" key on the "product_preorder" metaobject inside products inside an order? 

Freelance Shopify Developer & Ecommerce Operator
Seattle, WA ️
Replies 4 (4)

tom_hammer
Shopify Staff
4 0 0

If it's a list, the references are on "<resource>.metafields.references.fields"

 

If it's a single value, use "reference" instead

 

paul_n
Shopify Staff
946 128 225

To clarify, you would check the namespace and key as you are doing already. Then you would need to check the field name under "metafields / reference / fields / name == enabled".

 

I'll add - keep going with this, but we are working on improvements to make this way better. 

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.
lindahlcorp
Shopify Partner
4 0 1

Thanks @paul_n ! 

 

I didn't see any "fields" under "metafields_item / reference"?  I tried to go into the "product" and explored several levels in there but didn't see anything where I can access the field's name.

 

lindahlcorp_0-1710957792507.png

 

 

I would be great if improvements could be done on this so its easier to use! 

 

Honestly I just might remove the "enabled" field off the schema in this metaobject because it seems redundant - I think if the metaobject exists on a product, then it is enabled. I might be making this too complex.

Freelance Shopify Developer & Ecommerce Operator
Seattle, WA ️
paul_n
Shopify Staff
946 128 225

Sorry, if it's a metaobject, then select Metaobject first. I think fields is there.

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.