Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
I have started working on a a checkout ui extension. What I want to do is access the customer's email that they enter. Is there a way to get this information from the contact field on the checkout information page, perhaps using a hook or object from the useExtensionAPI?
As a followup, will the customer object obtained from useExtensionAPI only be defined if the customer is logged in?
Thank you.
There's a BuyerIdentity property https://shopify.dev/docs/api/checkout-ui-extensions/2023-07/apis/standardapi#properties-propertydeta...
Note that this requires access to protected customer data.
App() {
const { buyerIdentity : { customer }} = useApi()
// .. you now have access to customer object (i.e. customer.id, customer.email) ..
}