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

PropertyTypeScopeDescriptionExample
store.idStringGlobalUnique ID of the storestr_0axet1jhdjj2p
store.accessTokenStringGlobalStore 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

  1. Keep tokens secure: The accessToken grants API access; never expose it in UI, logs, or client-side code that users can inspect.
  2. Read-only data: The store variable cannot be modified and reflects values configured in Shopify.
  3. Global availability: The store object is accessible across all app contexts (PDP, PLP, Cart, etc.) — no need to reinitialize it.
  4. Use for backend calls: Prefer using the token for server-to-server authenticated requests rather than direct frontend requests.

Caveats

  1. Do not share or hardcode access tokens. Tokens are sensitive credentials tied to your Shopify store.
  2. Always follow your organization’s security policies for storing or using access tokens.