Draft Order Metafields Don't Copy to Created Order

I currently use Cart Attributes to copy over some data from a draft order to a paid order for my app and tried to migrate to metafields but it seems the metafields do not copy over onto the paid order.

We do the same things with orders and draft orders and it works but you only when you have a metafield definition on the order and draft order resouces.

In your case where do to the cart attributes come into play?

Hi @Logan_Gelzer ,

Cart attributes and draft order metafields follow different paths. Draft order metafields don’t copy to the resulting Order automatically. The Draft order and Order definitions must be linked with a one-way sync; two independently created definitions aren’t enough.

To enable copying:

  1. Go to Settings > Metafields and metaobjects > Draft orders.
  2. Open the source definition.
  3. Under Matching order definition, select Create order definition.
  4. Save it.

The definitions’ type and validation details must match. See Copy metafield values from draft orders to orders.

This mapping can’t currently be configured through the public Admin API. If you use app-owned definitions and the option isn’t available in Admin, detect draft completion, retrieve DraftOrder.order, and write the value using metafieldsSet.

If you already configured the linked definition, could you share:

  • The namespace, key, type, and validations for both definitions
  • Whether the matching definition still appears in Admin
  • How the draft is created and completed, including the API version

Yeah follow this advice, this should work!