useAppMetafields

Hello

I’m trying to use

  const appMetafields = useAppMetafields({
    namespace: 'test',
    key: 'test_key',
  });

inside customer-account.order.action.menu-item.render target but i’m getting the following error:
Uncaught ExtensionHasNoFieldrror: Cannot access ‘appMetafields’ on target ‘customer-account.order.action.menu-item.render’. The corresponding property was not found on the API.

Indeed when looking at the documentation here
the hook seems to be not available.
is there any way I can still use this metafield?

Thanks

Hi Lucas - it doesn’t look like this is supported. Can you describe the exact usecase you’re trying to achieve?

Hello Liam
Thanks for your answer.
I wanted to check an API and the baseUrl of my middleware is saved in a metafields but I found another way to get the information threw the shopify graphql API.
But just out of curiosity, is there a technical or function reason why it’s not supported?
Thanks

Hey!

In customer account extensions, you should be using the Customer Account API to query metafields.

Only order status page targets support querying the metafields declared in the extension toml file, for continuity with Checkout. This method is going to go away eventually in Checkout and the Order status page targets as well, as it doesn’t allow for getting fresh metafield values (e.g. if a metafield is updated after your extension initially renders).

Thanks Kenza for the explanation.
Then I will use the Customer API whenever I ll need this metafield value.