Skip to main content
0.2.0 ports the missing Shopify commerce surfaces from @jaimin28/react-native-shopify into the SDK while keeping Stackfront’s managed features and react-query architecture. Existing screens keep working: the legacy members below are deprecated, not removed.

Package renamed

The package is now @stackfront/react-native-shopify (it was react-native-stackfront-sdk). Replace the import specifier and the install line; the /keychain subpath moved with it:
The native module name (StackfrontSdk) and the podspec are unchanged, so no iOS/Android reconfiguration is needed beyond reinstalling dependencies.

Auth hardening in 0.2

  • register(input) creates the account and signs in with the same credentials in one action. createAccount(input) remains for create-only.
  • createAccount / create now throw CustomerCreateError on Shopify customerUserErrors instead of returning a silently failed payload.
  • Dead sessions self-heal: a customer: null response clears the token, persistence and auth-scoped caches, and hasSession flips to false. CustomerSessionError is thrown with reason: 'invalid' | 'expired'.
  • Renewal is single-flight, happens during boot when the token is inside the 30-day window, and never overwrites a session that changed mid-request.
  • Double-submit is serialized: rapid duplicate login/register taps cannot create two tokens or two accounts.
  • New flags on useCustomer(): isAuthenticated (alias of hasSession), isRestoring, isRefreshing.
  • A follow-up profile read failing after a successful login/registration is treated as transient — the session stands and the profile query retries.

Not adopted from the reference package

  • Multi-account sessions / lock-unlock: the SDK keeps one active session. Multiple long-lived Shopify tokens on a device multiply exposure, and a lock that only flips a boolean is cosmetic. Use sign-out/sign-in for account switching and the platform biometrics for app lock.
  • Optimistic updateCustomer: the SDK keeps server truth; the profile cache is seeded with Shopify’s response (no rollback flicker).
  • Keychain by default: keychain remains an explicit opt-in behind the /keychain subpath so apps that never use it do not bundle the peer.

At a glance

useProduct

The string form still works and data is still the raw Storefront node:
New screens should use the options object and the engine members:
  • data is kept as an alias of product (deprecated for new screens).
  • metafields is a flat array; request them in the same round trip via the metafields option.
  • A selected variant is resolved even before the shopper touches an option when the variant matrix has a single valid combination; impossible combinations appear in disabledOptions.
  • addToCart uses the SDK’s cart and is double-submit guarded.

useSearch

  • setQuery(text) updates query immediately and performs a debounced Storefront read; do not debounce again in the screen.
  • History is persisted by the SDK (search_history, max 20). If your app kept its own recent-search list, migrate it (or switch to the SDK’s) to avoid two competing histories.
  • suggestions combines history with titles/vendors/tags from the current result page, or pass explicit sources via availableSuggestionsOptions.
  • data is still the raw search connection; results is the flattened node array.

useWishlist

  • Items gained id, variantId, selectedOptions, title, image, createdAt and updatedAt. addedAt remains as a deprecated mirror of createdAt, so existing cards keep rendering.
  • isInWishlist(productId, variantId?) is variant-aware; without a variant it matches any saved variant of the product.
  • remove(productId, variantId?) removes one variant, or every variant of the product when variantId is omitted.
  • The first boot after upgrading reads the legacy wishlist key, writes wishlist_v2, and removes the legacy key. No action is required.
  • Saving richer items is a drop-in upgrade:

useOrders

useOrders() without arguments keeps the flat-list contract. Passing any option switches to the paged form:
New hooks: useInfiniteOrders, useOrder, useOrderHistory, useOrderTracking, usePrefetchOrders, usePendingOrders, useCompletedOrders, useCancelledOrders, plus the pure orders/* helpers (deriveOrderStatus, extractTrackingInfo, deriveOrderTimeline, toStorefrontOrderSort, filterOrders). The Storefront API has no standalone order-by-id query and no full order timeline. useOrder is cache-first (falling back to the first page of 50), and tracking/timeline are derived honestly from successfulFulfillments, financialStatus, fulfillmentStatus and canceledAt. Shopify’s official timeline link is exposed as statusUrl.

Addresses and menus

  • Address ids carry a rotating customer_access_token suffix. Pass them back as received and compare with sameAddressId(a, b) — never ===.
  • Menu route values are app-agnostic paths (/products/<handle>), not a hard-coded deep-link scheme.
  • Address mutations invalidate both the address book and the customer profile; menu reads are public Storefront data.

useCheckout

getCheckoutUrl() still works but is deprecated:
  • The session is a view over the cart. Storefront no longer exposes a checkout* API, expiresAt, completedAt or a cancel mutation.
  • refresh() on app foreground discovers a consumed/expired cart (it stops resolving). Completion/cancellation deep links are reported by your app via markCompleted() / markCancelled().
  • cancel() abandons the session locally and leaves the cart intact.
  • The SDK does not open browsers or listen to Linking/AppState.

Keychain (optional)

react-native-keychain is an optional peer dependency. Keep AsyncStorage (the default) or opt in:
Only the customer session token moves; other SDK caches stay in AsyncStorage. Token renewal happens automatically near expiry.

Deprecations

Nothing above is removed in 0.2.0.