snipcart
Add e-commerce to any website with Snipcart. Use when a user asks to add a shopping cart to a static site, sell products from a JAMstack site, add buy buttons to any HTML page, or integrate e-commerce without a backend.
What this skill does
# Snipcart
## Overview
Snipcart adds a full shopping cart to any website with just HTML attributes. No backend needed — it works with static sites, JAMstack, and any HTML page. Handles checkout, payments, shipping, taxes, and inventory.
## Instructions
### Step 1: Add to Any Page
```html
<!-- Add Snipcart scripts to your page -->
<link rel="stylesheet" href="https://cdn.snipcart.com/themes/v3.4.1/default/snipcart.css" />
<script async src="https://cdn.snipcart.com/themes/v3.4.1/default/snipcart.js"></script>
<div hidden id="snipcart" data-api-key="YOUR_PUBLIC_API_KEY"></div>
<!-- Product buy button — just HTML attributes -->
<button class="snipcart-add-item"
data-item-id="tshirt-001"
data-item-name="Premium T-Shirt"
data-item-price="29.99"
data-item-url="/products/tshirt"
data-item-image="/images/tshirt.jpg"
data-item-description="100% organic cotton"
data-item-custom1-name="Size"
data-item-custom1-options="S|M|L|XL">
Add to Cart — $29.99
</button>
<!-- Cart summary button -->
<button class="snipcart-checkout">
Cart (<span class="snipcart-items-count">0</span>)
</button>
```
### Step 2: Astro/Next.js Integration
```astro
---
// components/ProductCard.astro — Product card for static site
const { product } = Astro.props
---
<div class="product-card">
<img src={product.image} alt={product.name} />
<h3>{product.name}</h3>
<p class="price">${product.price}</p>
<button class="snipcart-add-item"
data-item-id={product.id}
data-item-name={product.name}
data-item-price={product.price}
data-item-url={`/products/${product.slug}`}
data-item-image={product.image}>
Add to Cart
</button>
</div>
```
### Step 3: JavaScript API
```javascript
// Customize cart behavior with Snipcart JS API
document.addEventListener('snipcart.ready', () => {
Snipcart.api.cart.items.added((item) => {
console.log('Item added:', item.name)
// Track in analytics
})
Snipcart.api.cart.confirmed((order) => {
console.log('Order confirmed:', order.token)
// Send to CRM, trigger email, etc.
})
})
```
## Guidelines
- Snipcart takes 2% transaction fee + payment processor fees. No monthly fee.
- Products are validated against your HTML — Snipcart crawls the product URL to verify prices.
- Works with any SSG (Astro, Hugo, 11ty, Gatsby) — perfect for JAMstack e-commerce.
- Supports subscriptions, digital products, and multi-currency.
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.