For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
Hello all,
I found out if I want to create a metafield then I can use this method "useApplyMetafieldsChange()".
My question is:How can I create a METAOBJECT in the context of Checkout UI Extension React JS base?
Greets
Danyel
Hi there 👋
Thanks for reaching out! You are correct that there currently is not a react hook to allow you to easily create a MetaObject from a Checkout UI extension.
At this time the only way to do so would be to make a network request to your apps server which would in turn create the MetaObject.
Could you share your use case for creating a MetaOject from a Checkout UI extension so that I can share this information with the team?
To learn more visit the Shopify Help Center or the Community Blog.
Thank you for your answer, Lizk.
I have build a select box contains a lot of shop names in the checkout. The user can choose his desired shop name. I want to store the address data of the selected shop name in a metaobject, like this:
id: 42423423
title: 'store name',
street: 'lindenstr.'
zipcode: '52343'
city: 'Bremen'
My workaround is now to save the data in the metafield in this structure:
"store_name|lindenstr. 7|52343|Bremen"
And the BE can split this string into an Array.
But in the end the possibility to create a Metaobject would be fine.
Thanks a lot
Hi Lizk,
Can we read metaobjects in the checkout UI extension? Is there any hook to only just grab data of metaObject in checkout ui?