Skip to main content

Overview

v2 is a ground-up redesign of the SDK. The Shopify Storefront API dependency has been removed, all controllers now expose reactive signals with built-in subscribe(), and the public API surface has been renamed and simplified. This guide covers every breaking change and provides before/after code snippets to help you migrate.

Install

Initialization

The factory function and its configuration object have been renamed.

Config property renames

Removed config options

These options no longer exist in v2 since the Storefront API has been removed:
  • enableStorefront
  • storefrontApiVersion
  • productMetafields / variantMetafields / collectionMetafields / pageMetafields
  • options
  • cacheMaxProducts

Storefront API removal

v2 builds products entirely from Layers API data. The Storefront API integration has been removed. What this means:
  • Remove any @shopify/storefront-api-client dependency
  • The storefront() method no longer exists on the client
  • Collection metadata (title, description, image) is now fetched via includeMeta: true on collection.execute() rather than from the Storefront API
  • Product metafields are available through the metafields property on the Product type, sourced from Layers

Controllers

All controllers now have subscribe()

Every controller in v2 exposes a subscribe() method for reacting to state changes without importing signal primitives.

Collection

Search now accepts initial options at creation time and merges parameters across execute() calls.

Autocomplete renamed to suggest

Blocks

Product type changes

v2 introduces a simplified Product type built entirely from Layers data.

Key differences

  • Shallow by default: Products include only the matched variant in variants. The price, compareAtPrice, and availableForSale fields are sourced from that variant. featuredMedia is also sourced from the matched variant, and falls back to the product-level media when the variant has none. To request the full variants array, set flags: { variants: true } in createClient.
  • selectedOptions is now on the product itself (the matched variant’s options)
  • breakoutOptions replaces the previous breakout variant handling
  • options are now RichProductOption[] with code and optional swatch
  • category field added with taxonomy data
  • metafields is a nested Record<string, Record<string, unknown>> (namespace/key structure)
  • combinedListingParentProductId and combinedListingRole added for combined listings

Removed product fields

These fields from the Storefront API are no longer present:
  • descriptionHtml
  • onlineStoreUrl
  • seo
  • publishedAt
  • collections (use includeMeta on collection queries instead)

Error handling

Error types have been renamed and restructured.

Cache and store

The store module has been replaced with a flat cache API.

New in v2

These features are only available in v2:
  • searchContent controller for searching articles and blog content
  • createProductCard reactive controller for building product cards with variant selection, option availability, and pricing signals
  • subscribe() on all controllers for framework-agnostic reactivity
  • Request deduplication via the built-in RequestCoordinator
  • temporary flag on search for one-shot query overrides that don’t persist
  • prepare() on search for warming the API with a searchId before executing
  • Shallow products for significantly smaller payloads on listing pages

Type renames