cart-logic

Implement shopping cart add, update, persistence, and guest-to-user merge logic across ecommerce platforms.

3|1|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/tomtoto757/ecomm-ai-team --skill cart-logic-tomtoto757
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cart-logic
Source: https://github.com/tomtoto757/ecomm-ai-team/tree/main/skills/checkout-payments-tax/finsilabs/payments-checkout/cart-logic
Command: npx skills add https://github.com/tomtoto757/ecomm-ai-team --skill cart-logic-tomtoto757

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Shoppers lose items when carts fail to persist across pages, devices, or login sessions, and custom headless storefronts often reimplement cart logic incorrectly, causing duplicate line items, stale prices, and lost sales. ## Core Features & Use Cases - Platform Configuration Guidance: Step-by-step cart setup for Shopify, WooCommerce, and BigCommerce, including persistent carts, cart drawers, and guest-to-account merge behavior. - Headless Cart Implementation: Storefront API code patterns for Shopify and BigCommerce covering cart creation, line item additions, and buyer identity association on login. - Conversion-Focused Cart UX: Instructions for mini-cart drawers, low-stock warnings, 30-day guest persistence, and free shipping progress bars. - Use Case: A headless Shopify storefront loses guest carts after login; use this Skill to wire cartBuyerIdentityUpdate so the guest cart merges into the customer account automatically. ## Quick Start Use the cart-logic skill to implement a persistent shopping cart with guest-to-user merge for my Shopify headless storefront.

Frequently Asked Questions about cart-logic

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

FAQPage Schema
How do I persist a shopping cart across sessions and devices?▼

Cart persistence works by storing the cart server-side for logged-in customers and using a long-lived cart token cookie for guests. Shopify uses a 30-day cart_token cookie by default, while WooCommerce requires enabling Persistent cart under Accounts & Privacy settings.

How to merge a guest cart into a user account after login?▼

Guest cart merge happens automatically on Shopify and WooCommerce when persistent carts are enabled. For headless builds, call Shopify's cartBuyerIdentityUpdate mutation to associate the guest cart with the customer account, and Shopify handles the merge.

Does Shopify support custom cart logic for headless storefronts?▼

Yes, Shopify's Storefront API provides cartCreate, cartLinesAdd, and cartLinesUpdate mutations for headless carts. Store the returned cart ID in a cookie or localStorage and use Cart Transform Functions for custom discounts or bundles.

Why does the same product appear twice in the cart instead of incrementing quantity?▼

Duplicate line items occur when add-to-cart logic creates a new line instead of updating an existing one. Platform-native carts handle this automatically; in headless implementations, use cartLinesUpdate to increment quantity on existing lines.

Why does a WooCommerce cart disappear after the user logs in?▼

This happens when Persistent cart is disabled in WooCommerce settings. Enable it under WooCommerce, Settings, Accounts & Privacy so the cart is stored in the database and merged with the guest session on login.