Checkout metafields not persisting on abandoned cart recover or login

:waving_hand: Hi Shopify dev community!

We’ve run into a bit of an unexpected situation. We have a Shopify Checkout Extension that writes metafields to the checkout*. Upon checkout, we use these metafields (now on the order) for different behavior.

However, we’ve noticed two situations where the metafields are seemingly dropped from the checkout*: logging in + abandoned cart recovery links.

Reproduction steps:

  1. Set up a simple Checkout extension that writes a metafield to the checkout*
  2. In your checkout extension, add a debug statement to print out the checkout* metafields and confirm the metafields were written
  3. Refresh the page and confirm the debug statement still prints out the metafields on the checkout*
  4. Log into Shopify (or trigger an abandoned cart email)
  5. You’ll now see that the debug statement from step 2 no longer shows metafields on the checkout*

Anyone else happen to run into this issue? Or know a better way to persist the checkout* metafields?

*Edit: in an earlier version of this post, I incorrectly said we were writing metafields to the cart. We are not. We are writing to the checkout.

Can you confirm the metafield type you are using along-side the applyMetafieldChange UI extension API? Is it the "updateMetafield" or "updateCartMetafield"?

We’re using the updateMetafield type since we need the metafield carried over to the order. My apologies - I’ve edited the thread title to reflect that.