Possible to read order metafield in Thank you and Order status page - UI Extension?

I could not find clear information in the docs, but is it possible to access an order metafield (set by another app but in a public namespace) in a Thank you and Order status page - UI Extension ?

From the docs it seems metafields on the order resource are not available: Configuration but maybe I am missing an API here?

You’re able to query Order Metafields using Admin GraphQL API once the order has been created.

Here you can find the Checkout Extensions APIs available:
https://shopify.dev/docs/api/checkout-ui-extensions/2024-07/apis

And here you can find more information about Metafields during and after Checkout:
https://shopify.dev/docs/api/checkout-ui-extensions/2024-07/apis/metafields#standardapi-propertydetail-metafields

Cheers,
Enrique

1 Like

Hey Enrique,
thank you for your answer. But for using the Admin api my extension would require network access and a backend which proxies these requests.

I was hoping that I can somehow query the order metafields (because in the context of the thank you or order status page we have the order created) with the api. But it seems that only the checkout metafields can be read and theses are later stored in the order but the extension api can not read them.

HI! :smiley:

I think you can query the order’s metafield using the useApi() hook but, i think you can not mutate it. And i think is the mutation you need to do as the metafield is empty :frowning:

But here it is if you want to query it only
HERE WAS A LINK BUT CANNOT INSERT IT

https://shopify.dev/docs/api/checkout-ui-extensions/2024-01/targets/block/purchase-thank-you-block-render#standardapi-propertydetail-metafields

To write into metafields from a thank you page i would like to know that too :frowning: as it does not explain it anywhere :slight_smile:

I tried this, as @Liam-Shopify sugested me in an issue i opened, but no luck as it only works on customer-account :frowning:
HERE WAS A LINK BUT CANNOT INSERT IT

https://shopify.dev/docs/apps/build/customer-accounts/metafields?extension=react

Here is what i found til now:

HERE WAS A LINK BUT CANNOT INSERT IT

https://github.com/Andyrei/shopify-template-extension-app-survey/blob/main/extensions/survey-test/src/Checkout.tsx#L150

Let me know if you found anything else :slight_smile:

Hey @Andydrei - I’ve increased your trust level so you should be able to post multiple links now.

1 Like