For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
I have used the Customer account UI extensions to access the customer metafield with the Storefront API from a full page, but it seems not to be possible because there is no unauthenticated_read_customers in the scope.
Storefront API access scopes
Your extensions will have the following unauthenticated access scopes to the Storefront API:
- unauthenticated_read_product_publications
- unauthenticated_read_collection_publications
- unauthenticated_read_product_listings
- unauthenticated_read_product_tags
- unauthenticated_read_selling_plans
- unauthenticated_read_collection_listings
- unauthenticated_read_metaobjects
https://shopify.dev/docs/api/customer-account-ui-extensions/unstable/configuration#api-access
As an alternative, I considered using network access to access the customer metafield.
The documentation for network access reads as follows
Alternatives to network access
Instead of fetching data with an external network call, consider retrieving the data from a metafield. Your app may be able to use the Admin API to write metafields on the shop, product, or customer.
Retrieving data from metafields in new customer accounts is faster since it won't introduce an external network call. This allows you to rely on Shopify for the uptime, scaling, and durability of the data storage.
https://shopify.dev/docs/api/customer-account-ui-extensions/unstable/configuration#network-access
This seems contradictory.
Is there a way to access the customer meta field in the Storefront API from a full page using the Customer account UI extensions?
Solved! Go to the solution
This is an accepted solution.
I was able to solve this problem with this example.
This is an accepted solution.
I was able to solve this problem with this example.
Hey, could you explain what was the problem? The scope or implementation? Is it possible to reach the customer's metafield from checkout using the checkout UI extension?
I remember being able to access customer metafields by fetching from "shopify://customer-account/api/unstable/graphql.json" while using the customer account UI extension. However, I am not sure if it's possible to access customer metafields with the checkout UI extension.
Ok, thanks. I'm able to access it now with checkout UI, but the problem is I'm still unable to overwrite the customer metafield with a new value. I can only read it.