跳到主要内容

折扣

管理折扣、优惠券和营销活动。包含 8 个快捷命令和 15 个 API 命令。

快捷命令

搜索已有折扣。

shoplazza discounts +search [flags]
参数类型说明
--querystring按折扣名称模糊搜索
--discount-codestring按折扣码搜索
--progressstring进度过滤:ongoingnot_startedfinishedpaused
--discount-typestring折扣类型过滤
--discount-targetstring目标过滤:productordershipping
--discount-methodstring方式过滤:automaticdiscount_code
--page-limitint页面大小(1–250)
shoplazza discounts +search
shoplazza discounts +search --query "Summer"
shoplazza discounts +search --discount-code SALE20
shoplazza discounts +search --progress ongoing --discount-type flashsale

+rebate

创建自动阶梯满减(满额减/满件折)。

shoplazza discounts +rebate [flags]
参数类型必填说明
--targetstring范围:orderproduct
--tiersstring阈值:折扣 对(逗号分隔,如 100:10,200:25
--typestring类型:amount-offamount-percentqty-offqty-percent(默认:amount-off
--productsstring商品 ID(逗号分隔;target=product 时使用)
--collectionsstring集合 ID(与 --products 互斥)
--variantsstring变体 ID(与 --products 互斥)
--excludebool将 ID 作为排除列表(默认:false
--limit-maxint最大总使用次数
--limit-userint每用户最大使用次数
--limit-order-oncebool每单最多应用一次(默认:true
--combinesstring允许叠加:orderproductshipping
--customer-segmentsstring限定客户群 ID
--namestring活动名称(不填则自动生成)
--startstring开始时间(默认:now
--endstring结束时间(默认:-1,永不过期)
# 订单满 100 减 10,满 200 减 25
shoplazza discounts +rebate --target order --tiers "100:10,200:25"

# 商品满 3 件打 8 折
shoplazza discounts +rebate --target product --type qty-percent \
--tiers "3:20" --products "id1,id2"

+flashsale

创建限时特卖(自动折扣)。

shoplazza discounts +flashsale [flags]
参数类型必填说明
--valuefloat折扣值:percent → 1–99;fixed-price → 新价格;off → 减免金额
--typestring类型:percentfixed-priceoff(默认:percent
--variantsstring变体 ID(与 --collections 互斥)
--collectionsstring集合 ID(与 --variants 互斥)
--price-rulestring基于价格:price(售价)或 compare_at_price(默认:price
--limit-user-variantint每用户每变体最大购买量
--limit-user-productint每用户每商品最大购买量
--limit-user-allint每用户跨所有活动商品最大购买量
--stockint折扣专用库存上限
--combinesstring允许叠加
--customer-segmentsstring限定客户群
--namestring活动名称
--startstring开始时间(默认:now
--endstring结束时间(默认:-1
# 全场 8 折
shoplazza discounts +flashsale --value 20

# 指定变体定价 19.99
shoplazza discounts +flashsale --value 19.99 --type fixed-price --variants "v1,v2"

# 带库存限制
shoplazza discounts +flashsale --value 30 --stock 100 --limit-user-variant 2

+mn-discount

创建第 N 件折扣(买 M 件第 N 件打折)。

shoplazza discounts +mn-discount [flags]
参数类型必填说明
--tiersstringN:percent 对(如 2:30,3:50:买 2 件第 2 件 7 折,买 3 件第 3 件 5 折)
--scopestring应用层级:highestallhighest-all(默认:highest
--productsstring商品 ID
--collectionsstring集合 ID
--variantsstring变体 ID
--excludebool将 ID 作为排除列表(默认:false
--price-sortstring价格排序方向:desc(高→低)或 asc(默认:desc
--combinesstring允许叠加
--limit-maxint最大总使用次数
--limit-userint每用户最大使用次数
--customer-segmentsstring限定客户群
--namestring活动名称
--startstring开始时间(默认:now
--endstring结束时间(默认:-1
shoplazza discounts +mn-discount --tiers "2:30,3:50"
shoplazza discounts +mn-discount --tiers "3:50" --products "id1,id2"

+percent-code

创建百分比折扣码。

shoplazza discounts +percent-code [flags]
参数类型必填说明
--targetstring范围:orderproduct
--percentfloat折扣百分比(1–99)
--productsstring商品 ID(target=product 时使用)
--variantsstring变体 ID
--collectionsstring集合 ID
--excludebool将 ID 作为排除列表
--min-amountfloat最低订单金额(target=order
--min-quantityint最少商品数量(target=product,默认:1
--codestring折扣码(不填则自动生成)
--combinesstring允许叠加
--limit-maxint最大总使用次数
--limit-userint每用户最大使用次数
--customer-segmentsstring限定客户群
--namestring活动名称
--startstring开始时间(默认:now
--endstring结束时间(默认:-1
# 订单级 8 折
shoplazza discounts +percent-code --target order --percent 20

# 自定义折扣码
shoplazza discounts +percent-code --target order --percent 10 --code SAVE10 \
--min-amount 50 --limit-max 500 --limit-user 1

+amount-code

创建固定金额折扣码。

shoplazza discounts +amount-code [flags]
参数类型必填说明
--targetstring范围:orderproduct
--offfloat固定减免金额
--productsstring商品 ID
--variantsstring变体 ID
--collectionsstring集合 ID
--excludebool将 ID 作为排除列表
--min-amountfloat最低订单金额
--min-quantityint最少商品数量(默认:1
--limit-order-oncebool每单最多应用一次(默认:true
--codestring折扣码
--combinesstring允许叠加
--limit-maxint最大总使用次数
--limit-userint每用户最大使用次数
--customer-segmentsstring限定客户群
--namestring活动名称
--startstring开始时间(默认:now
--endstring结束时间(默认:-1
shoplazza discounts +amount-code --target order --off 10
shoplazza discounts +amount-code --target order --off 20 --code OFF20 --min-amount 100

+bxgy-code

创建买 X 送 Y 折扣码。

shoplazza discounts +bxgy-code [flags]
参数类型必填说明
--productsstring购买侧商品 ID
--variantsstring购买侧变体 ID
--collectionsstring购买侧集合 ID
--excludebool购买侧 ID 作为排除列表
--buy-quantityint触发所需总件数(与 --buy-amount 互斥)
--buy-amountfloat触发所需总金额(与 --buy-quantity 互斥)
--get-productsstring赠品侧商品 ID
--get-variantsstring赠品侧变体 ID
--get-collectionsstring赠品侧集合 ID
--get-quantityint赠品数量
--get-percentint赠品折扣百分比(1–99;percent/off/free 三选一)
--get-offfloat赠品固定减免
--get-freebool赠品免费
--codestring折扣码
--limit-orderint每单最多应用次数(默认:1-1 为无限)
--combinesstring允许叠加
--limit-maxint最大总使用次数
--limit-userint每用户最大使用次数
--customer-segmentsstring限定客户群
--namestring活动名称
--startstring开始时间(默认:now
--endstring结束时间(默认:-1
# 买 3 件 A 商品,送 1 件 B 商品
shoplazza discounts +bxgy-code --products "prodA" --buy-quantity 3 \
--get-products "prodB" --get-quantity 1 --get-free

+free-shipping-code

创建包邮折扣码。

shoplazza discounts +free-shipping-code [flags]
参数类型说明
--offfloat运费减免金额(不填为全额包邮)
--min-amountfloat最低订单金额(与 --min-quantity 互斥)
--min-quantityint最少商品数量(与 --min-amount 互斥)
--countriesstringISO 国家代码(逗号分隔)或 all
--codestring折扣码
--combinesstring允许叠加
--limit-maxint最大总使用次数
--limit-userint每用户最大使用次数
--customer-segmentsstring限定客户群
--namestring活动名称
--startstring开始时间(默认:now
--endstring结束时间(默认:-1
# 全额包邮
shoplazza discounts +free-shipping-code

# 满 100 包邮
shoplazza discounts +free-shipping-code --min-amount 100

# 指定国家
shoplazza discounts +free-shipping-code --countries US,CA --code FREESHIP

API 命令

所有动态 API 命令共享以下参数:

参数短参说明
--params路径/查询参数(JSON 格式)
--data请求体(JSON 格式)
--jq-qjq 表达式过滤输出
--dry-run预览请求,不实际执行

discounts

shoplazza discounts list
shoplazza discounts get --params '{"discount_id":"123"}'
shoplazza discounts create-automatic --data @discount.json
shoplazza discounts create-non-automatic --data @discount.json
shoplazza discounts update-automatic --params '{"discount_id":"123"}' --data @discount.json
shoplazza discounts update-non-automatic --params '{"discount_id":"123"}' --data @discount.json
shoplazza discounts delete --params '{"discount_id":"123"}'
shoplazza discounts batch-delete --data '{"ids":["123","456"]}'
shoplazza discounts get-by-code --params '{"code":"SALE20"}'
shoplazza discounts cancel --params '{"discount_id":"123"}'
shoplazza discounts restart --params '{"discount_id":"123"}'
shoplazza discounts combine --data @combine.json

discounts coupons

shoplazza discounts coupons create --data @coupon.json
shoplazza discounts coupons get --params '{"coupon_id":"123"}'
shoplazza discounts coupons update --params '{"coupon_id":"123"}' --data @coupon.json

Schema 自省

shoplazza schema discounts
shoplazza schema discounts.create-automatic