Metafields for an order through the API

AFerrara
Shopify Partner
12 1 6

I am frustrated that orders.json does not return the metafields.  I am updating data in an external system so once an order ships out of Shopify, I'm sweeping the tracking data through the API.  I am using metafields to store two data points which refer to an external system, so, in the sweep logic since the metafields are not returned with the order data I have to do a second lookup.  This data should come back just like the line_items object for instance.  Am I missing something?  I do have control over the input side of things so if there is a better place to store these two reference points when we import the order originally, I don't mind changing the code to pull them back from somewhere besides a metafield.  I appreciate any thoughts on this subject, and Shopify please add this to the feature requests for the API. 

Thanks,

Art

Reply 1 (1)

Visely-Team
Shopify Partner
1843 210 488

This is true for metafields for all resources, not only orders. It's just the way it was designed.

 

You have two options:

1) use note_attributes instead of metafields so you get everything in one call;

2) use GraphQL API instead of REST API, so you can query more than one resource in one call. 

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog