I’m trying to save the customers birthday in the facts.birth_day metafield but am unable to do this using the Checkout UI API. At least when the customer is not logged in as the useCustomer() function returns undefined when the customer isn’t logged in.
Alternatively I tried to query one of my app’s API endpoints and use the Admin API to set the metafield to the customer with specified email. Currently I can’t get this to work due to authentication. It seems i can only authenticate request sent from checkout using following code:
import {
Banner,
useApi,
useTranslate,
reactExtension,
useMetafield,
useAppMetafields,
useApplyMetafieldsChange,
useCustomer,
BlockStack,
TextField,
DateField
} from '@shopify/ui-extensions-react/checkout';
import { useEffect } from 'react';
export default reactExtension(
'purchase.thank-you.block.render',
() =>
Unfortunately this doesn't work.
The facts.birth_date isn't returned.
Furthermore I get an error about using applyMetafieldsChange on the 'purchase.thank-you.block.render' target.

Any assistance would be greatly appreciated.
I also have a similar problem. How to use useApplyMetafieldsChange() on a customer’s metafield? I need to assign a VAT number after purchase. I tested it on the development store with all accesses and I’m logged in.
I can get value if I provide it in CMS with useAppMetafields, but I can’t overwrite it with useApplyMetafieldsChange.