Store
Easy way to access Store Details from Shopify in Superfans SDK.
Description
The store variable provides access to core Shopify store identifiers within the Superfans SDK.
It is primarily used for secure API calls, analytics, or debugging. This data is global and available throughout the app session.
Properties
Store variables are unique to each store
| Property | Type | Scope | Description | Example |
|---|---|---|---|---|
store.id | String | Global | Unique ID of the store | str_0axet1jhdjj2p |
store.accessToken | String | Global | Store access token used for authorized Shopify API requests. | xxxxxxxxxxxxxxxxx |
Example Usage
const store = VajroSDK.variables.store;
if (store) {
console.log(`Store ID: ${store.id}`);
// Use the access token for secure API requests
const headers = {
"X-Shopify-Access-Token": store.accessToken,
"Content-Type": "application/json",
};
console.log("Headers ready for Shopify API:", headers);
} else {
console.log("Store variable unavailable.");
}Best Practices
- Keep tokens secure: The accessToken grants API access; never expose it in UI, logs, or client-side code that users can inspect.
- Read-only data: The store variable cannot be modified and reflects values configured in Shopify.
- Global availability: The store object is accessible across all app contexts (PDP, PLP, Cart, etc.) — no need to reinitialize it.
- Use for backend calls: Prefer using the token for server-to-server authenticated requests rather than direct frontend requests.
Caveats
- Do not share or hardcode access tokens. Tokens are sensitive credentials tied to your Shopify store.
- Always follow your organization’s security policies for storing or using access tokens.
Updated about 1 month ago