We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Error when using metafields in Customer account UI extension

Error when using metafields in Customer account UI extension

upzadam
Shopify Partner
2 0 2

Hi,

 

I've been trying to access some metafield data inside a Customer Account UI Extension, however I'm finding it impossible no matter what I try. I have checkout extensions that use the same code to access metafields that work fine, however it seems they are not accessible within new customer accounts.

 

Here's my code:

 

 

 

 

import {
  TextBlock,
  reactExtension,
  useMetafield,
} from "@shopify/ui-extensions-react/customer-account";

export default reactExtension(
  "customer-account.order-index.block.render",
  () => <Refer />
);

function Refer() {
  const stuff = useMetafield({key: 'mykey', namespace: 'mynamespace'});
  return (<TextBlock>Hello world</TextBlock>);
}

 

 

 

 

And this is the error that it's throwing:

 

Screenshot 2024-10-01 at 07.50.46.png

 

Am I missing something? The documentation suggests that metafields are available, and the methods exist to access them.

 

Thanks 😀

Reply 1 (1)

upzadam
Shopify Partner
2 0 2

Further investigation has concluded that Metafields are not available. Can the Shopify team give an indication if/when this may change?