I am developing shopify checkout ui extention and i am trying to access shop data using graphql query as
// State for storing locations data
const [locations, setLocations] = useState();
useEffect(() => {
const apiVersion = ‘unstable’;
const getLocationsQuery = {
query: { shop{ billingAddress{ address1 address2 company city country } } }
};
// Perform the fetch request
fetch(${shop.storefrontUrl}api/${apiVersion}/graphql.json, {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’,
},
body: JSON.stringify(getLocationsQuery),
})
.then(response => response.json())
.then(({ data, errors }) => {
if (errors) {
console.error(errors);
return;
}
const locationsData = data;
setLocations(locationsData);
console.log(‘Locations:’, locationsData); // Console log locations data
})
.catch(console.error);
}, [shop]); // Add shop as a dependency to useEffect
I am reciving error stating you dono have “unauthenticated_read_product_pickup_locations” access
but i have added this scope in shopify.app.toml file
i have already reinstalled the app and even tried deploying the updates using npm run deploy to updates the access scopes