关于 dynamic-pricing
dynamic-pricing 是面向电商商家的动态定价实施指南,说明如何依据需求、库存、竞品价格和业务规则调整价格,并设置护栏与审核流程。
主要功能
- 01按平台选择调价工具
- 02依据需求和库存调整价格
- 03监测竞品价格并自动调价
- 04设置价格上下限与变更阈值
- 05记录价格历史并支持审核
适用场景
- 01为高周转商品跟进竞品价格
- 02自动降价清理滞销库存
- 03按客户群体设置价格
- 04测试价格弹性并控制变更风险
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ finsilabs/ awesome-ecommerce-skills --skill dynamic-pricing安装后在 Claude Code 中输入/dynamic-pricing确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
tile.jsonevals/competitor-monitoring-price-history-sche/criteria.jsontask.mdevals/core-pricing-algorithm-with-demand-signa/criteria.jsontask.mdevals/guardrails-human-review-queue-and-oscill/criteria.jsontask.md详细介绍
动态定价
概述
动态定价会根据需求信号、库存水平、竞争对手价格和业务规则自动调整产品价格。目标是最大化每售出一件商品的收入——需求旺盛或库存稀缺时提高价格,滞销库存则降价清理。大多数 Shopify 和 WooCommerce 商家会使用调价应用,而非编写自定义代码。自定义实现通常仅用于无头店面,或有特殊调价逻辑且应用无法满足需求的商家。
何时使用此技能
- 当销量较高的 SKU 因价格设置后无人管理、而竞争对手每小时都在调整价格而损失收入时
- 当你需要通过自动降价计划清理滞销库存时
- 当你运营的市场需要卖家的价格应对竞争压力时
- 当你为易腐或有时效性的库存构建收益管理系统时
- 当你大规模进行价格弹性 A/B 测试,并需要一个可安全推出价格变更的框架时
核心说明
步骤 1:确定商家使用的平台并选择合适的工具
| 平台 | 推荐工具 | 原因 |
|---|---|---|
| Shopify | Prisync、Wiser 或 Skio Pricing | Prisync 会监控竞争对手价格,并通过 Shopify Admin API 推送价格更新;Wiser 会使用需求信号和库存信息 |
| Shopify Plus | Prisync + Shopify Flow 自动化 | Shopify Flow 可根据库存或销售速度信号,通过 webhook 触发价格变更 |
| WooCommerce | Prisync、Repricer.com(通过 WooCommerce API)或通过 WooCommerce REST API 自行实现 | 大多数调价工具都通过产品 API 支持 WooCommerce |
| BigCommerce | Prisync、Linnworks 或 ChannelAdvisor | BigCommerce 的 Price Lists API 专为基于细分群体的动态定价而设计 |
| Amazon/多渠道 | RepricerExpress、BQool 或 Seller Snap | 专为 Amazon 调价而打造,并支持 Buy Box 优化 |
| 自定义/无头 | 构建一个调用平台定价 API 的定价任务 | 完全掌控;当自定义逻辑超出应用的处理能力时,这是必需的 |
步骤 2:配置任何工具之前,先定义定价规则
在使用任何工具之前,先记录你的限制条件——这些条件可防止调价算法做出损害利润或客户信任的决策:
| 规则 | 示例 |
|---|---|
| 价格下限 | 绝不低于成本 × 1.15(最低毛利率为 15%) |
| 价格上限 | 绝不超过 MSRP 或设定的最高价格 |
| 每轮最大变更幅度 | 单次调价运行中,价格变动绝不超过 20% |
| 变更阈值 | 只有新价格与当前价格相差超过 2% 时才更新(防止微幅振荡) |
| 锁定时段 | 正在进行限时抢购或促销时不调整价格 |
| 人工审核阈值 | 任何超过 10% 的变更都必须先提交人工审批,再予以应用 |
步骤 3:按平台进行设置
Shopify
选项 A:Prisync(基于竞争对手的重新定价)
- 在 prisync.com 注册,并通过集成连接你的 Shopify 商店
- 在 Prisync 控制面板中添加要跟踪的竞争对手产品网址
- 设置重新定价规则:“匹配竞争对手最低价”、“低于 X%”或“匹配并低于”
- 为每件产品设置最低价和最高价
- Prisync 会按照你配置的计划(每小时、每天)自动将价格更新推送到 Shopify
选项 B:Shopify Flow(基于库存/需求,适用于 Shopify Plus)
- 在 Shopify 管理后台中,前往 Apps → Flow
- 创建一个新工作流,触发条件为 库存水平变化 或自定义 webhook
- 添加一个条件,例如:“库存数量少于 10”
- 添加一个操作:更新产品变体,并将价格设为更高的值
- 添加一个单独的工作流,在库存恢复时还原原价
将原价存储为产品元字段(product.metafields.pricing.original_price),以便随时还原。
选项 C:用于基于需求重新定价的第三方应用
- Wiser(Shopify App Store):根据销售速度、加入购物车率和库存,建议并应用价格变动
- Bold Commerce's Pricing:支持安排价格变动并设置自动化规则
WooCommerce
选项 A:Prisync + WooCommerce REST API
- 使用 REST API 凭据将 Prisync 连接到 WooCommerce(WooCommerce 设置 → 高级 → REST API → 添加密钥)
- 在 Prisync 中将产品与竞争对手网址关联
- 在 Prisync 中配置重新定价规则和计划
- Prisync 会调用
PUT /wp-json/wc/v3/products/{id}/variations/{id}更新价格
选项 B:通过 WP-Cron 定时重新定价
要在 WooCommerce 中基于需求重新定价,请使用定时任务:
- 编写一个 PHP 函数,通过 WooCommerce 的订单历史记录检查库存水平和销售速度
- 使用 WP-Cron 或服务器 cron 安排运行
- 调用
wc_get_product()->set_price()和save(),以编程方式更新价格 - 将每次价格变动记录到自定义表中,以便审计和回滚
选项 C:YITH Dynamic Pricing 插件
要按时间变更价格(计划降价):
- 安装 YITH WooCommerce Dynamic Pricing & Discounts
- 创建规则,在特定日期范围内应用百分比折扣
- 这比完整的动态重新定价更简单,但足以满足“季末”降价需求
BigCommerce
BigCommerce 的 Price Lists 功能非常适合按客户细分动态定价:
- 前往 Products → Price Lists
- 为每个客户群组创建价格列表(例如,“demand_high_inventory_low”)
- 使用 BigCommerce Price Lists API,根据定价逻辑以编程方式更新价格
- 通过 Customers → Customer Groups 将价格列表分配给客户群组
若要在不细分客户的情况下为整个网站动态定价,请使用 BigCommerce Catalog API,根据重新定价计划更新产品的 sale_price。
第三方工具:Linnworks 和 ChannelAdvisor 均可与 BigCommerce 集成,并包含竞争对手监控和自动重新定价功能。
自定义 / 无头架构
对于无头店面,请实现一个按计划运行的重新定价任务:
import { CronJob } from 'cron';
interface PricingContext {
productId: string;
currentPriceCents: number;
costCents: number;
inventoryLevel: number;
salesVelocity7d: number; // units/day rolling average
competitorLowestCents?: number; // from price intelligence feed
floorCents: number;
ceilingCents: number;
}
function computeNewPrice(ctx: PricingContext): { priceCents: number; reason: string } {
let price = ctx.currentPriceCents;
const reasons: string[] = [];
// Inventory pressure: near stockout → slow demand with a price increase
if (ctx.inventoryLevel <= 5 && ctx.salesVelocity7d > 0.5) {
price = Math.round(price * 1.08);
reasons.push('low_inventory');
}
// Slow mover: markdown if no meaningful sales in 7 days
if (ctx.salesVelocity7d < 0.1) {
price = Math.round(price * 0.95);
reasons.push('slow_mover_markdown');
}
// Competitor pricing: stay competitive
if (ctx.competitorLowestCents && price > ctx.competitorLowestCents * 1.05) {
price = Math.round(ctx.competitorLowestCents * 0.99); // undercut by 1%
reasons.push('competitor_undercut');
}
// Enforce guardrails
const marginFloor = Math.round(ctx.costCents * 1.15);
price = Math.max(price, marginFloor, ctx.floorCents);
price = Math.min(price, ctx.ceilingCents);
// Only apply if change exceeds 2% threshold
const changePct = Math.abs(price - ctx.currentPriceCents) / ctx.currentPriceCents;
if (changePct < 0.02) return { priceCents: ctx.currentPriceCents, reason: 'below_threshold' };
// Cap single-run change at 20%
if (changePct > 0.20) {
const direction = price > ctx.currentPriceCents ? 1 : -1;
price = Math.round(ctx.currentPriceCents * (1 + direction * 0.20));
reasons.push('capped_at_20pct');
}
return { priceCents: price, reason: reasons.join(',') || 'no_change' };
}
// Run every 30 minutes during business hours
new CronJob('*/30 6-22 * * *', async () => {
const products = await db.products.findAll({ dynamicPricingEnabled: true });
for (const product of products) {
const ctx = await buildPricingContext(product);
const { priceCents, reason } = computeNewPrice(ctx);
if (priceCents !== ctx.currentPriceCents) {
await platformApi.updatePrice(product.id, priceCents);
await db.priceHistory.insert({ productId: product.id, oldPrice: ctx.currentPriceCents, newPrice: priceCents, reason, changedAt: new Date() });
}
}
}, null, true, 'America/New_York');
最佳实践
- 始终设置与成本挂钩的价格底线 — 计算
floor = cost × 1 + min_margin并确保其不可逾越;不允许任何算法将价格降到成本价以下 - 保存完整的价格历史记录 — 每次价格变更都需要记录一行,包含时间戳、旧价格、新价格和原因,以便回滚、审计和弹性分析
- 限制单次运行的价格变更幅度 — 将单次作业运行的变更幅度限制在 ±20%,以防止错误数据或程序错误导致价格失控
- 将价格建议与应用分开 — 引擎提出价格建议;由单独的步骤应用价格。这样可以设置人工审核队列并支持试运行模式
- 对大幅自动变更发出提醒 — 当引擎应用的价格变更幅度超过 10% 时,发送 Slack 或电子邮件提醒,以便人工审核
- 对价格变更进行 A/B 测试 — 在全站推出新价格前,使用 A/B 测试定价技能对一部分访客进行测试
常见问题
| 问题 | 解决方案 |
|---|---|
| 竞品价格战期间,价格跌破成本价 | 强制执行 Math.max(newPrice, costCents * 1.15),将其作为算法无法绕过的绝对底线 |
| 过时的竞品价格导致错误调价 | 为每条竞品价格记录保存 fetched_at;跳过超过 4 小时的价格 |
| 价格振荡——引擎反复提价又降价 | 在价格变更之间增加至少 2 小时的冷却时间,并设置 2% 的迟滞区间 |
| 限时促销期间触发调价 | 应用算法调价前检查是否有正在进行的促销;为正在促销的商品添加 is_price_locked 标记 |
| CDN/搜索索引在价格更新后仍提供旧价格 | 每次价格变更后立即清除商品页面缓存并更新搜索索引 |
相关技能
- @ab-testing-pricing
- @flash-sale-engine
- @price-rules-engine
- @volume-pricing
- @discount-engine