cart-logic
БесплатноБез исполняемых скриптовНе проверенBuild a robust shopping cart with add/remove/update operations, session persistence across devices, and cart merge for returning logged-in users
от finsilabs★ 69 звёзд на GitHubОб этом скилле
Cart Logic
Overview
Cart logic covers how your store manages items a shopper intends to buy: adding, removing, and updating items; persisting the cart across page loads and devices; and merging a guest cart into an account when the customer logs in. On Shopify, WooCommerce, and BigCommerce, the cart is built into the platform — the goal is to configure it correctly and extend it when needed. Custom code is only required for headless storefronts.
When to Use This Skill
- When cart state is lost when users navigate between pages (missing persistence)
- When guest cart items disappear after login (missing merge logic)
- When implementing real-time cart price updates (coupons, quantity changes, shipping estimates)
- When building a headless storefront that needs a custom cart implementation
Core Instructions
Step 1: Understand how your platform handles cart logic
| Platform | Cart Behavior | Where to Configure |
|---|---|---|
| Shopify | Built-in cart with automatic persistence; uses cookies/localStorage | Theme Liquid templates + Cart API; extend with Cart Transform Shopify Function |
| WooCommerce | Built-in cart with session persistence; configures via PHP hooks | WooCommerce settings + woocommerce_add_cart_item_data and woocommerce_cart_item_price filters |
| BigCommerce | Built-in Storefront Cart API; cart persists via cookie | BigCommerce Stencil theme + Storefront Cart API |
| Custom / Headless | Must build from scratch using platform APIs or Shopify/BigCommerce Storefront API | See Custom / Headless section below |
Step 2: Configure and extend cart behavior
Shopify
Shopify's cart is managed automatically. To extend it:
Customize the cart drawer or page:
- Go to Online Store → Themes → Customize
- Select the cart section and configure: cart type (drawer vs. page), item display, quantity controls
- Enable Cart notes and Shipping estimate in the cart settings if needed
Enable cart persistence across devices (requires accounts):
- Shopify automatically persists cart for logged-in customers; the cart is stored server-side on their account
- For guest carts, Shopify uses a
cart_tokencookie (30-day expiry by default)
Merge guest cart on login:
- Shopify handles this automatically — when a guest logs in, their cart is merged with any existing account cart
Cart customization via Shopify Functions: Use Cart Transform Shopify Functions to modify cart items, apply custom discounts, or bundle products. Go to Settings → Custom data and deploy a Cart Transform function via the Shopify CLI.
Custom cart upsells and cross-sells: Install CartHook, ReConvert, or Frequently Bought Together from the Shopify App Store for cart upsell logic without custom code.
WooCommerce
WooCommerce's cart is built-in and session-based.
Configure cart behavior:
- Go to WooCommerce → Settings → Products → General to configure cart and add-to-cart behavior
- Enable or disable Redirect to cart page after successful addition based on your store's UX preference
- Under WooCommerce → Settings → Advanced → Cart page, verify the cart page is assigned
Enable persistent cart for logged-in users:
- Go to WooCommerce → Settings → Accounts & Privacy
- Enable Persistent cart — this stores a logged-in customer's cart in the database so it survives across sessions and devices
Guest cart to account merge: WooCommerce automatically merges the guest cart with the customer's saved cart when they log in. To ensure this works, keep Persistent cart enabled.
Extend cart item data (e.g., for product customization options):
Use the woocommerce_add_cart_item_data filter in your theme's functions.php or a custom plugin to attach extra data to cart items (gift messages, engraving text, etc.).
Cart abandonment tracking: Install CartFlows or WooCommerce Cart Abandonment Recovery plugin to track and recover abandoned carts.
BigCommerce
BigCommerce uses its Storefront Cart API for cart management.
Configure cart settings:
- Go to Settings → Storefront to configure cart and checkout behavior
- Cart persistence is automatic via BigCommerce's session management
Customize the cart via Stencil theme:
Edit cart templates in your Stencil theme (templates/components/cart/) to modify the cart page layout, item display, and available actions.
Cart upsells: Use the BigCommerce Cart API to detect items in the cart and conditionally show related products or promotions in the cart template.
Custom / Headless
For a headless storefront, use your platform's Storefront API rather than building cart storage from scratch:
Shopify Storefront API (recommended for Shopify-backed headless stores):
// Create a cart
const createCart = async () => {
const response = await fetch(`https://${SHOP_DOMAIN}/a
Установить cart-logic в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
claude-codecursorgemini-clicopilotcodex-clikiroopencodeВложенные файлы
FAQ
Что делает скилл cart-logic?
Build a robust shopping cart with add/remove/update operations, session persistence across devices, and cart merge for returning logged-in users
Как установить скилл cart-logic?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cart-logic запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic