SuperAPI AI 工具集

shopify-polaris-customer-account-extensions

前端与建站

查看项目

更新于 10-16 03:06

技能介绍

用途:帮助 Shopify 开发者编写客户账户 UI 扩展(Customer Account UI Extensions),在客户账户的订单列表、订单状态、资料页等预定义位置构建商家可安装的自定义功能。

主要能力:提供 Polaris Web Components(s- 前缀自定义元素,如 s-banner、s-badge、s-button、s-text 等,全局注册无需导入)的用法;覆盖多个扩展目标(如 customer-account.order-status.block.render、customer-account.order-index.block.render、customer-account.profile.block.render 等),目标决定可用组件与 API;提供 Analytics、Customer Account API、Storefront API、Session Token、Storage、Toast 等 API 及订单状态相关数据接口。

使用方式:需先搜索文档再写代码,最后验证。脚手架命令:shopify app generate extension --template=customer_account_ui --name=my_customer_account_ui_extension。搜索:scripts/search_docs.mjs "<query>" --model YOUR_MODEL_NAME --client-name YOUR_CLIENT_NAME --client-version YOUR_CLIENT_VERSION。验证:scripts/validate.mjs --code '...' --model ... --client-name ... --client-version ... --artifact-id ... --revision ... --target <extension-target>,--target 必填,验证失败最多重试 3 次。使用 Preact 入口:import "@shopify/ui-extensions/preact"; import { render } from "preact";。属性用 camelCase,字符串类属性须为字符串值。

适用场景:为商家在客户账户各页面注入自定义 UI 与交互。

限制:代码中不得包含 HTML 注释;必须完成搜索与验证步骤;版本为 2026-01;搜索与验证脚本会向 Shopify 上报查询、结果及模型/客户端标识,可设 OPT_OUT_INSTRUMENTATION=true 退出。