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:
- Set up a simple Checkout extension that writes a metafield to the checkout*
- In your checkout extension, add a debug statement to print out the checkout* metafields and confirm the metafields were written
- Refresh the page and confirm the debug statement still prints out the metafields on the checkout*
- Log into Shopify (or trigger an abandoned cart email)
- 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.