跳到主要内容
版本:202201

更新价格规则

PUT 

/openapi/2022-01/price_rules/:price_rule_id

通过指定价格规则 ID 和新参数修改现有价格规则。

请求

Path参数

    price_rule_id string必填

    价格规则 ID。

请求体

    price_rule object
    titlestring

    Title of this price rule

    valuedouble

    Value for this discount , e.g. 50.25

    value_typestring

    Discount type, options: 1. fixed_amount for fixed amount of value to be reduced, 2. percentage for percentage of the value to be reduced

    usage_limitint32

    The usage limit, -1 means no limit

    allocation_limitint32

    Redeem count limit for checkout: 0~999, 0 means only one redeem allowed, 999 means no limit

    once_per_customerint32

    The max usage per customer,-1 or 0 means no limit

    prerequisiteint32

    Does this discount has prerequisite or not, 1 means yes, 0 means no

    默认值: 1
    target_selectionstring

    The target products allowed of this discount, all means all products, entitled means only for the specific products

    target_typestring

    Target type of this discount, for example: line_item, shipping_line

    starts_atstring

    Discount started at

    ends_atstring

    Discount ended at, -1 means no limit

    entitled_product_idsstring[]

    Specify the target products allowed for the price rule. This field is required only when target_selection is entitled, e.g. [ "ac8ed089-55d9-4f58-a0f9-3dda4e4607cc", "0b76afba-e068-4bf6-85f5-660019f58488" ]

    entitled_variant_idsstring[]

    Specify the variants products allowed of the discount, e.g. [ "cea210d5-a419-4d4e-a17d-5bbd0bc4af76", "de2c55f5-c3e1-45e1-92f6-e65faf816ecc" ]

    entitled_collection_idsstring[]

    Specify the collections allowed of the discount, e.g. ["aa92c677-e5be-4cab-8e65-9ebc55b98240","e6152ca6-791b-4385-a9e1-49adb336b289"]

    prerequisite_subtotal_range object[]

    Prerequisite for the total amount of the money, for example: [ { "greater_than_or_equal_to": "10", "value": "1", "target_type": "", "target_data": [] } ] means total money must great than 10, then you could use the discount to reduce 1 dollar.

  • Array [
  • greater_than_or_equal_tostring

    To specify the value which the price has to greater than or equal to.

    valuestring

    The value used for the discount to apply, the reduction type is decided by value_type specified in Price Rule params

    target_typestring

    Target type

    target_datastring[]

    Target data

    默认值: []
  • ]
  • prerequisite_quantity_range object[]

    Prerequisite for the total count of the products,e.g. [ { "greater_than_or_equal_to":"5", "value":"20", "target_type":"", "target_data":[] } ] means products count must great than 5, then you could use discount to reduce 20 dollars

  • Array [
  • greater_than_or_equal_tostring

    To specify the value which the price has to greater than or equal to.

    valuestring

    The value used for the discount to apply, the reduction type is decided by value_type specified in Price Rule params

    target_typestring

    Target type

    target_datastring[]

    Target data

    默认值: []
  • ]

响应

200

数据结构
    price_rule object
    idstring
    示例: 00095d6a-419d-4499-a497-f265fb2edaa5
    titlestring
    示例: title-update
    valueinteger
    默认值: 0
    示例: 0
    value_typestring
    示例: percentage
    usage_limitstring
    示例: -1
    times_usedstring
    示例: 0
    allocation_methodstring
    示例:
    allocation_limitstring
    示例: 0
    once_per_customerstring
    示例: 1
    prerequisitestring
    示例: 1
    customer_selectionstring
    示例: all
    target_selectionstring
    示例: entitled
    target_typestring
    示例:
    created_atstring
    示例: 2020-03-06 17:00:32
    updated_atstring
    示例: 2020-03-12 15:29:44
    starts_atstring
    示例: 1583424000
    ends_atstring
    示例: 1583942399
    entitled_product_idsstring[]
    entitled_variant_idsarray
    prerequisite_quantity_range object[]
  • Array [
  • greater_than_or_equal_tostring
    示例: 1
    valuestring
    示例: 5
    target_typestring
    示例:
    target_dataarray
  • ]
  • prerequisite_subtotal_range