跳到主要内容
版本:202607

更新自动折扣

PUT 

/openapi/2026-07/discounts/automatic/:id

通过 ID 更新指定的自动折扣活动。

请求

Path参数

    id string必填

    折扣 ID

请求体必填

    discount object必填

    折扣信息

    discount_info object

    折扣信息

    discount_namestring

    折扣名称

    display_namestring

    店铺前台展示名称

    starts_atint32

    开始时间

    ends_atint32

    结束时间。-1 表示折扣永久有效

    entitled_customer object

    授权顾客

    customer_idsstring[]

    顾客 ID 列表

    customer_segment_idsstring[]

    顾客分组 ID 列表

    entitled_product object

    授权商品

    product_idsstring[]

    商品 ID 列表

    variant_idsstring[]

    规格 ID 列表

    collection_idsstring[]

    集合 ID 列表

    sort object

    排序配置

    bystring

    商品排序字段

    directionstring

    排序方向,如 asc(升序)或 desc(降序)

    selectionstring

    商品范围选择策略:

    • entitled: 仅包含指定商品
    • exclude: 排除指定商品
    • all: 包含所有商品(默认)
    sku_extends object

    各规格的扩展设置,以规格 ID 为键

    property name* SkuExtendReq
    obtain_valuestring

    领取值

    min_purchase_qtyuint32

    最小购买数量

    sequint32

    序列号

    virtual_salesint32

    虚拟销量

    follow_stockstring

    活动库存是否跟随商品库存:

    • product: 同商品库存
    • discount: 使用活动库存
    stockint32

    库存数量

    collection_idstring

    集合 ID

    discount_rule object

    折扣规则

    limit_max_discountint32

    折扣最大使用次数,-1 表示不限

    limit_user_discountint32

    每位顾客最大使用次数,-1 表示不限

    limit_order_discountint32

    每笔订单最大使用次数,-1 表示不限

    limit_user_product_typestring

    每用户商品数量限制策略:

    • no_limit: 不限制商品购买次数
    • customer_all_product: 按顾客/折扣汇总所有参与规格的购买次数
    • customer_product: 按顾客/折扣/商品限制购买次数
    • customer_variant: 按顾客/折扣/规格限制购买次数
    limit_user_product_discountint32

    每用户每商品折扣上限

    price_rulestring

    折扣计算的基准价格:

    • price: 使用销售价
    • compare_at_price: 使用划线价/原价
    product_discount_orderstring

    折扣应用时的商品排序策略:

    • desc: 按商品价格从高到低应用
    • asc: 按商品价格从低到高应用
    virtual_salesint32

    虚拟销量

    stockint32

    库存数量

    follow_stockstring

    活动库存是否跟随商品库存:

    • product: 同商品库存
    • discount: 设置活动库存
    discount_combinesstring[]

    可叠加的折扣类别:

    • product: 可与商品折扣叠加
    • order: 可与订单折扣叠加
    • shipping: 可与运费折扣叠加
    mn_discount_scopestring

    多层折扣评估的范围策略:

    • highest: 仅应用匹配到的最高档折扣
    • all: 应用所有匹配的折扣层级
    • highest_all: 应用所有匹配层级,超出最高档的数量按最高档优惠计算
    discount_layer object

    折扣层级

    condition_typestring

    条件类型:

    • no_condition: 无条件
    • purchase_quantity: 满件数
    • purchase_amount: 满金额
    obtain_typestring

    优惠类型:

    • no_discount: 无优惠
    • free_acquisition: 免费领取
    • percent: 百分比折扣
    • fixed_price_reduction: 固定金额减免
    • fixed_price: 固定最终价格
    • fixed_quantity: 固定数量赠送
    • product_price_reduction: 商品级别价格减免
    layers object[]

    层级列表

  • Array [
  • condition_valuestring

    条件值

    obtain_valuestring

    领取值

    obtain_countuint32

    领取数量

  • ]

响应

OK

数据结构
    codestring

    错误码

    messagestring

    错误信息

    data object
    discount object

    折扣信息

    discount_info object

    折扣信息

    idstring

    折扣 ID

    discount_namestring

    折扣名称

    display_namestring

    店铺前台展示名称

    discount_targetstring

    折扣目标类别:

    • product: 商品折扣
    • order: 订单折扣
    • shipping: 运费折扣
    categorystring

    折扣分类(顶层折扣类型):

    • buy_one_get_one: 买一赠一
    • buy_x_get_y: 买 X 赠 Y
    • bundle: 捆绑折扣
    • rebate: 满减折扣
    • m_n_discount: M 换 N 折扣
    • flash_sale: 限时特卖
    • code: 折扣码
    • coupon_old: 旧版优惠券
    • plugin_old: 旧版插件折扣
    • rebate_old: 旧版满减
    • cycle_subscribe_old: 旧版周期订购
    discount_typestring

    折扣类型:

    • rebate_cta_otr: 满额固定减免
    • rebate_ctq_otr: 满量固定减免
    • rebate_cta_otp: 满额百分比折扣
    • rebate_ctq_otp: 满量百分比折扣
    • m_n_discount: M 换 N 折扣
    • flashsale: 限时特卖折扣
    • code_percent: 折扣码百分比折扣
    • code_fix_price_reduction: 折扣码固定减免
    • code_bxgy: 折扣码买 X 赠 Y
    • code_free_shipping: 折扣码免运费
    discount_methodstring

    折扣方式:

    • automatic: 自动应用
    • discount_code: 折扣码触发
    discount_codestring

    折扣码

    discount_codesstring[]

    该折扣下的所有折扣码列表

    starts_datestring

    开始日期

    ends_datestring

    结束日期

    starts_atint32

    开始时间

    ends_atint32

    结束时间

    created_atstring

    创建时间(ISO-8601 格式)

    updated_atstring

    最后更新时间(ISO-8601 格式)

    is_old_discountboolean

    是否为旧版折扣

    progressstring

    当前进度状态:

    • ongoing: 进行中
    • not_started: 未开始
    • finished: 已结束
    • paused: 已暂停
    enable_all_customerboolean

    是否对所有顾客启用

    is_show_adminstring

    是否在管理后台显示

    time_usedint32

    已使用次数

    entitled_customer object

    授权顾客

    customer_idsstring[]

    顾客 ID 列表

    customer_segment_idsstring[]

    顾客分组 ID 列表

    entitled_product object

    授权商品

    product_idsstring[]

    商品 ID 列表

    variant_idsstring[]

    规格 ID 列表

    collection_idsstring[]

    集合 ID 列表

    sort object

    排序配置

    bystring

    排序字段

    directionstring

    排序方向

    beforestring

    时间排序起始值(单位:秒),用于兼容旧版限时特卖

    selectionstring

    商品范围选择策略:

    • entitled: 仅包含授权商品
    • exclude: 排除授权商品
    • all: 包含全部商品
    sku_extends object

    规格扩展配置,以规格 ID 为键

    property name* SkuExtendResp
    obtain_valuestring

    领取值

    min_purchase_qtyuint32

    最小购买数量

    sequint32

    序列号

    virtual_salesint32

    虚拟销量

    follow_stockstring

    活动库存是否跟随商品库存:

    • product: 同商品库存
    • discount: 设置活动库存
    stockint32

    库存数量

    collection_idstring

    集合 ID

    obtain_product object

    领取商品

    product_idsstring[]

    商品 ID 列表

    variant_idsstring[]

    规格 ID 列表

    collection_idsstring[]

    集合 ID 列表

    sort object

    排序配置

    bystring

    排序字段

    directionstring

    排序方向

    beforestring

    时间排序起始值(单位:秒),用于兼容旧版限时特卖

    selectionstring

    商品范围选择策略:

    • entitled: 仅包含授权商品
    • exclude: 排除授权商品
    • all: 包含全部商品
    sku_extends object

    规格扩展配置,以规格 ID 为键

    property name* SkuExtendResp
    obtain_valuestring

    领取值

    min_purchase_qtyuint32

    最小购买数量

    sequint32

    序列号

    virtual_salesint32

    虚拟销量

    follow_stockstring

    活动库存是否跟随商品库存:

    • product: 同商品库存
    • discount: 设置活动库存
    stockint32

    库存数量

    collection_idstring

    集合 ID

    discount_rule object

    折扣规则

    limit_max_discountint32

    折扣最大使用次数,-1 表示不限

    limit_user_discountint32

    每位顾客最大使用次数,-1 表示不限

    limit_order_discountint32

    每笔订单最大使用次数,-1 表示不限

    limit_user_product_typestring

    每用户商品类型折扣上限:

    • no_limit: 不限制商品购买量
    • customer_all_product: 每用户每折扣,所有符合条件的规格累计
    • customer_product: 每用户每折扣每商品
    • customer_variant: 每用户每折扣每规格
    limit_user_product_discountint32

    每用户每商品折扣上限

    stockint32

    库存数量

    follow_stockstring

    活动库存是否跟随商品库存:

    • product: 同商品库存
    • discount: 设置活动库存
    virtual_salesint32

    虚拟销量

    price_rulestring

    价格规则:

    • price: 使用销售价格
    • compare_at_price: 使用划线价/原始价格
    extendsstring

    扩展列表

    product_discount_orderstring

    商品折扣排序:

    • desc: 按商品价格降序应用
    • asc: 按商品价格升序应用
    discount_combinesstring[]

    折扣叠加配置列表:

    • product: 可与商品折扣叠加
    • order: 可与订单折扣叠加
    • shipping: 可与运费折扣叠加
    obtain_fullboolean

    是否已满额领取

    mn_discount_scopestring

    多层折扣评估的范围策略:

    • highest: 仅应用最高匹配层
    • all: 应用所有匹配层
    • highest_all: 应用所有匹配层;超出最高层的数量按最高层优惠处理
    limit_code_max_discountint32

    每个折扣码最大使用次数,-1 表示不限。仅适用于非自动折扣

    limit_code_user_discountint32

    每位顾客每个折扣码最大使用次数,仅适用于非自动折扣

    enable_product_extendsboolean

    是否启用商品扩展信息

    discount_layer object

    折扣层级

    condition_typestring

    条件类型:

    • no_condition: 无条件限制
    • purchase_quantity: 需满足购买数量
    • purchase_amount: 需满足购买金额
    obtain_typestring

    领取类型:

    • no_discount: 无折扣
    • free_acquisition: 免费领取
    • percent: 百分比折扣
    • fixed_price_reduction: 固定金额减免
    • fixed_price: 固定最终价格
    • fixed_quantity: 固定数量领取
    • product_price_reduction: 商品级价格减免
    layers object[]

    层级列表

  • Array [
  • condition_valuestring

    条件值

    obtain_valuestring

    领取值

    obtain_countuint32

    领取数量

  • ]
  • discount_combine object

    折扣叠加配置

    use_with_otherboolean

    是否可与其他折扣叠加

    entitled_area object

    授权地区

    areas object[]

    地区列表

  • Array [
  • country_codestring

    国家代码(如 CN)

    province_codesstring[]

    省份代码列表

  • ]