Draft order metafields

ShiraBoa
Excursionist
13 0 6

Hi,

 

Is there a way for the metafields of my draft order to be added automatically to the final order, when the draft order is completed?

 

Thanks,

Replies 5 (5)

Jason
Shopify Expert
11190 225 2282

Not with a native feature within Shopify, but you could build a tool to automate that process if that's a need. For my own interest, since the metafield would remain on the Draft why do you need to transition it to the Order?

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
ShiraBoa
Excursionist
13 0 6

Thanks for replying.

I have other processes that use the metafields from the completed order, and I wanted to avoid changing those processes.

The idea to add the metafields to the draft order instead of directly to the order, has come from the need to reduce the number of calls to shopify's api later on in the process.

Thanks again  🙂

ozzyonfire
Shopify Partner
47 2 17

I'm also running into this problem. 

Using the GraphQL api, the only way to create an order is to create a draft order, then complete that draft order. I want some metafields on the final order, however the metafields I create on the Draft Order don't get carried over to the Order (unlike the Custom Attributes).

This shouldn't be a problem, because like you say, the metafields are still stored on the Draft Order. However, I don't see (anywhere in the docs) a way to access the Draft Order from the final Order. There doesn't seem to be a field, or connection that I can use to get the Draft Order from which the Order was created.

Any insight on this would be greatly appreciated. 

ankitgarg
Visitor
1 0 0

@Jason How can I add metafield object in draftorder creation rest api?

Raamyy
Shopify Partner
1 0 0

I believe this article would be a solution for the problem.

 

https://help.shopify.com/en/manual/custom-data/copy-to-order