commerce-js-integration

Implement headless storefronts with the Commerce.js SDK for products, carts, and checkout.

3|1|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/tomtoto757/ecomm-ai-team --skill commerce-js-integration-tomtoto757
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: commerce-js-integration
Source: https://github.com/tomtoto757/ecomm-ai-team/tree/main/skills/platform-integrations-infrastructure/finsilabs/headless-modern/commerce-js-integration
Command: npx skills add https://github.com/tomtoto757/ecomm-ai-team --skill commerce-js-integration-tomtoto757

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @chec/commerce.js, isomorphic-dompurify.

What problem does it solve? Adding e-commerce to a static site or JavaScript app usually requires a heavy backend or a full platform. This Skill provides the patterns and code to build a lightweight headless store using the Commerce.js (Chec) SDK, covering product display, cart management, and checkout without server-side commerce infrastructure. ## Core Features & Use Cases - Product Catalog Rendering: Fetch and display products with commerce.products.list() and retrieve(), including variants, formatted prices, and sanitized HTML descriptions. - Cart Management: Manage the full cart lifecycle (add, update, remove, empty, refresh) with React Context state sharing and variant selections. - Checkout & Order Capture: Generate checkout tokens, retrieve live shipping options, capture orders via Stripe, and list customer orders with JWT login. - Use Case: A boutique brand with a Next.js site and a Chec catalog can wire up a product grid, a shared cart with a badge count, and a Stripe checkout flow using the provided patterns. ## Quick Start Ask the AI to build a Next.js product page and cart using the Commerce.js SDK with your Chec public API key.

Frequently Asked Questions about commerce-js-integration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a shopping cart to a Next.js site with Commerce.js?▼

Install @chec/commerce.js, initialize one module-level Commerce client with your public key, and use commerce.cart.retrieve(), add(), update(), and remove() to manage cart state. Share the cart across components with a React Context provider and a useCart hook.

How does Commerce.js checkout work with Stripe?▼

Generate a checkout token from the cart with commerce.checkout.generateToken(cartId, {type: 'cart'}), fetch live shipping options with getLive(), then call commerce.checkout.capture() with customer, shipping, fulfillment, and a Stripe payment_method_id from Stripe.js.

What is the difference between the Chec public key and secret key?▼

The public key is safe for browser code and can read products and manage carts. The secret key can also manage orders and must only be used server-side, such as in Next.js API routes or build-time data fetching.

Why is my Commerce.js cart not persisting between page loads?▼

Commerce.js stores the cart ID in localStorage under chec_cart_id. If localStorage is unavailable or blocked, the cart will not persist. Also ensure you create a single Commerce client instance rather than a new one per render.

When should I not use Commerce.js for a headless store?▼

Commerce.js fits small catalogs under roughly 1,000 products without custom fulfillment logic. For larger catalogs, complex fulfillment, or enterprise requirements, a full platform like Shopify or commercetools is a better fit.