Getting Access
The SDK and Widget library are currently in beta. To request access, contact Layers Support and they will provide you with the necessary credentials to install the packages.
Installation
Once you have received your access credentials from Layers Support, you can install the packages:Peer Dependencies
The SDK requires the following peer dependencies for reactive state management:Quick Start
Direct API Usage
For simple API calls without reactive state:App Module Initialization
For client-side applications with reactive state and caching:Configuration Options
Layers API Configuration
Your Layers API token from the dashboard.
Store name for display purposes.
Your Shopify store domain (e.g.,
my-store.myshopify.com).Metafield namespaces to include. Can be an empty array.
Product attributes with
name, code, and usedIn array specifying where the attribute is used (Filter, Grouping).Brand color swatches with
value and swatch object containing either color (hex) or imageUrl.Custom Layers API URL. Defaults to
https://app.uselayers.com.Shopify Storefront Configuration
Your Shopify store domain.
Shopify Storefront API access token. Optional if using Layers-only mode.
Shopify Storefront API version.
App Options
Currency code for Layers fallback pricing.
Skip Shopify enrichment and use Layers data only.
Enable debug mode with
$CB console helper.Enable localStorage persistence for caching.
Maximum product entries to cache.
Maximum entries per endpoint cache.
Debounce delay for persistence writes in milliseconds.
Tree-Shakeable Imports
Import specific modules for smaller bundles:Debug Mode
When initialized withoptions.debug: true, access the $CB helper in your browser console:
Important Notes
All API methods return a
Result type instead of throwing exceptions. Always check for result.error before accessing result.data.