Token导航 LogoToken导航

Agent Skill · 研究检索

cart-logic(购物车逻辑)

cart-logic 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

cart-logic 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 57,638。

总安装 428周安装 18GitHub Stars 19下载 150核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cart-logic(购物车逻辑)
来源仓库:https://github.com/finsilabs/awesome-ecommerce-skills
仓库路径:skills/cart-logic
安装命令:
npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill cart-logic
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill cart-logic

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

cart-logic 解决购物车状态持久化、跨设备同步与登录合并等电商核心逻辑问题。适用于排查购物车丢失、Guest 转 Account 数据迁移或库存一致性异常场景。区分平台内置能力与自定义代码需求,提供 Shopify/BigCommerce 等平台专项方案。

使用前应明确前端架构(Headless 与否)与后端会话管理机制现状。cart-logic 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/cart-logic

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill car…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

cart-logic 怎么安装?

在终端执行 npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill cart-logic。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

cart-logic 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

cart-logic 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

cart-logic 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

cart-logic 用的人多吗?

公开数据是累计安装 428 次,近一周安装 18 次,下载 150 次,GitHub 19 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

cart-logic 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
cart-logic

购物车逻辑 · 本页

42819需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

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

PlatformCart BehaviorWhere to Configure
ShopifyBuilt-in cart with automatic persistence; uses cookies/localStorageTheme Liquid templates + Cart API; extend with Cart Transform Shopify Function
WooCommerceBuilt-in cart with session persistence; configures via PHP hooksWooCommerce settings + woocommerce_add_cart_item_data and woocommerce_cart_item_price filters
BigCommerceBuilt-in Storefront Cart API; cart persists via cookieBigCommerce Stencil theme + Storefront Cart API
Custom / HeadlessMust build from scratch using platform APIs or Shopify/BigCommerce Storefront APISee 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:

  1. Go to Online Store → Themes → Customize
  2. Select the cart section and configure: cart type (drawer vs. page), item display, quantity controls
  3. 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_token cookie (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:

  1. Go to WooCommerce → Settings → Products → General to configure cart and add-to-cart behavior
  2. Enable or disable Redirect to cart page after successful addition based on your store's UX preference
  3. Under WooCommerce → Settings → Advanced → Cart page, verify the cart page is assigned

Enable persistent cart for logged-in users:

  1. Go to WooCommerce → Settings → Accounts & Privacy
  2. 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:

  1. Go to Settings → Storefront to configure cart and checkout behavior
  2. 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}/api/2024-01/graphql.json`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-Shopify-Storefront-Access-Token': STOREFRONT_TOKEN,
    },
    body: JSON.stringify({
      query: `
        mutation cartCreate($input: CartInput!) {
          cartCreate(input: $input) {
            cart { id checkoutUrl }
            userErrors { field message }
          }
        }
      `,
      variables: { input: { lines: [{ merchandiseId: variantGid, quantity: 1 }] } },
    }),
  });
  const { data } = await response.json();
  return data.cartCreate.cart;
};

// Add an item to an existing cart
const addToCart = async (cartId, variantGid, quantity) => {
  const response = await fetch(`https://${SHOP_DOMAIN}/api/2024-01/graphql.json`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-Shopify-Storefront-Access-Token': STOREFRONT_TOKEN,
    },
    body: JSON.stringify({
      query: `
        mutation cartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {
          cartLinesAdd(cartId: $cartId, lines: $lines) {
            cart { id totalQuantity cost { totalAmount { amount currencyCode } } }
          }
        }
      `,
      variables: { cartId, lines: [{ merchandiseId: variantGid, quantity }] },
    }),
  });
  const { data } = await response.json();
  return data.cartLinesAdd.cart;
};

Store the cartId in a cookie or localStorage. On login, use cartBuyerIdentityUpdate to associate the cart with the customer's account — Shopify handles the merge automatically.

BigCommerce Storefront API (for BigCommerce-backed headless stores):

Use the BigCommerce Storefront Cart API (/api/storefront/carts) which handles cart creation, item management, and customer association automatically.

Step 3: Implement key cart UX behaviors

Regardless of platform, these are the cart behaviors that most affect conversion:

  1. Show mini-cart on add-to-cart — most Shopify, WooCommerce, and BigCommerce themes support a slide-out cart drawer that opens when an item is added; enable this instead of redirecting to the cart page
  2. Show stock levels in the cart — display "Only 2 left" warnings on items with low inventory; both Shopify and WooCommerce support this via metafields and cart item data
  3. Guest cart persistence — ensure guest carts survive for at least 30 days so returning visitors find their items; Shopify does this by default; WooCommerce requires the session duration setting to be configured
  4. Free shipping progress bar — show a "You're $X away from free shipping" bar in the cart; install Free Shipping Bar (Shopify) or WooCommerce Free Shipping Bar plugin

Best Practices

  • Use your platform's native cart — Shopify, WooCommerce, and BigCommerce carts are battle-tested and handle edge cases (stock validation, price changes, tax calculation) correctly
  • Enable persistent cart for logged-in customers — all three platforms support server-side cart storage for accounts; enable it
  • Validate stock at checkout, not only on add-to-cart — items may sell out while in a guest's cart; re-validate at checkout time (platforms do this automatically)
  • Show the cart total prominently — including item count and subtotal; reduces anxiety about total spend
  • For headless: use the platform's Storefront API — Shopify and BigCommerce Storefront APIs are production-hardened and handle cart merging, stock checks, and checkout initiation correctly

Common Pitfalls

ProblemSolution
Cart disappears when user logs in (WooCommerce)Ensure Persistent cart is enabled in WooCommerce → Settings → Accounts & Privacy
Guest cart is empty after browser restartCheck cookie expiry settings; Shopify uses 30-day cart tokens by default; WooCommerce session duration is configurable
Same item added twice instead of incrementing quantityThe platform's native cart handles this; if using headless with Storefront API, use cartLinesUpdate to increment quantity on existing lines
Cart shows outdated prices after a price changeShopify and WooCommerce automatically use current prices at checkout, not add-to-cart prices; a "price changed" notice appears automatically
Custom add-to-cart code bypasses stock checksAlways use the platform's official add-to-cart mechanisms; custom code that writes directly to cart storage skips inventory validation

Related Skills

  • @checkout-flow-optimization
  • @guest-checkout
  • @inventory-tracking
  • @stripe-integration

平台分布

Codex

33.88%
按下载量换算51

Claude

32.28%
按下载量换算48

Cursor

18.58%
按下载量换算28

Gemini CLI

9.1%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills