Requires write_price_rules access scope.
For more info , refer to:
PUT https://{handle}.myshopline.com/admin/openapi/v20220601/sales/price_rules/:price_rule_id.json
handle : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is open001.myshopline.com , the store handle is open001 .
Update PRICERULE
Path Parameters
  • price_rule_id string required
    Discount rule ID
Request Headers
  • Content-Type required
    The value of this field is fixed to application/json; charset=utf-8
  • Authorization string required
    The access token for the API. Please refer to App authorization to obtain the access token, and then put the obtained access token into the API request header in Bearer Token.
    Example:
    Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw
Request Body
  • price_ruleobject
    Discount rules
  • allocation_limit integer
    When buying x-d , you can distribute the limited to of the Discount in the shopping cart in the eligible situation . for example , if you are full of 1 piece x and get 1 piece of y discount , set up allocation_limit=2 , when the shopping cart has 3 pieces x Product , and 3
  • allocation_method string
    The distribution method of price rules , the acceptable value has ● each discount , which is suitable for Product in every participation . for example , for Discount price rules of $ 15 , each eligible Product at checkout will be matched Discount $ 15. at this time , the price is about $The discount amount calculated by across will be applied to the entire eligible Product for the price policy of Discount 15 dollars , for example , the discount will be distributed to the Product of each participation event , which is equivalent to $ 15 for the total Discount .When the target_type value is shipping_line , allocation_method must be each. default value across
  • ends_at string
    Rule end time
  • entitled_collection_ids array
    A list of IDs of collections that can be applied to the discount. ● If target_selection is entitled, then one of entitled_product_ids, entitled_collection_ids, entitled_variant_ids must be defined ● entitled_product_ids, entitled_collection_ids, and entitled_variant_ids are mutually exclusive, only one of them can be defined at the same time.
    Example: ``
  • entitled_country_ids array
    Array of country/region ID, temporarily useless
    Example: ``
  • entitled_product_ids array
    A list of IDs of products that will be entitled to this discount. ● If target_selection is entitled, then one of entitled_product_ids, entitled_collection_ids, entitled_variant_ids must be defined ● entitled_product_ids, entitled_collection_ids, and entitled_variant_ids are mutually exclusive, only one of them can be defined at the same time. ● A list of IDs of products that will be entitled for a Buy X Get Y type discount (which means list of Y products).
    Example: ``
  • entitled_variant_idsobject[]
    A list of IDs of variants that can be applied to the discount. ● If target_selection is entitled, then one of entitled_product_ids, entitled_collection_ids, entitled_variant_ids must be defined ● entitled_product_ids, entitled_collection_ids, and entitled_variant_ids are mutually exclusive, only one of them can be defined at the same time. ● A list of IDs of product variants that will be entitled for a Buy X Get Y type discount (which means list of Y products).
  • product_id string
    product id
  • variant_id string
    variant id
  • id string
    Discount rule ID
  • joint_discount boolean
    Whether to superimpose automatic discounts? The default value is false.
  • overlay_discount_code boolean
    Overlay Discount-discount code Discount allowing multiple promo code activities to be superimposed Discount
  • prerequisite_collection_ids array
    For a Buy X Get Y type discount, a list of IDs of collections for X products (prerequisites for this discount) cannot be used in combination with prerequisite_product_ids or prerequisite_variant_ids
    Example: ``
  • prerequisite_customer_ids array
    The premise : customers must belong to one of the search ( customer grouping ) requisite_saved_search_ids , which is saved by specify or one of the customers specify requisite_customer_ids .
    Example: ``
  • prerequisite_product_ids array
    For a Buy X Get Y type discount, a list of IDs of products for X products (prerequisites for this discount) cannot be used in combination with prerequisite_collection_ids or prerequisite_variant_ids
    Example: ``
  • prerequisite_quantity_rangeobject
    Promotion triggers the minimum quantity of items ● prerequisite_quantity_range and prerequisite_subtotal_range are mutually exclusive ● If both are empty, it is the trigger condition for no price or quantity
  • greater_than_or_equal_to integer
    ● nullable ● must be >0 ● only integers are acceptable (integer)
  • prerequisite_saved_search_ids array
    The premise : customers must belong to one of the search ( customer grouping ) requisite_saved_search_ids , which is saved by specify or one of the customers specify requisite_customer_ids .
    Example: ``
  • prerequisite_shipping_price_rangeobject
    Shipping must be less than or equal to the value , *non-required , default null . * 1 ) only the content can be filled in the content in target_type=shipping_line * 2 ) , the accuracy is consistent with the accuracy of the store currency
  • less_than_or_equal_to string
    Shipping must be less than or equal to the value . *non-required , default null . * 1 ) only content can be filled in target_type=shipping_line 2 ) values , the accuracy is consistent with the store currency response accuracy
  • prerequisite_subtotal_rangeobject
    Promotion triggers the minimum order amount ● prerequisite_quantity_range and prerequisite_subtotal_range are mutually exclusive ● If both are empty, it is the trigger condition for no price or quantity
  • greater_than_or_equal_to string
    ● nullable ● rounded to two decimal places
  • prerequisite_to_entitlement_purchaseobject
    When buying x get y , x Product needs to meet the amount threshold
  • prerequisite_amount string
    X Product required amount threshold , not the same as prerequisite_quantity
  • prerequisite_to_entitlement_quantity_ratioobject
    When buying x get y , the number threshold and number of y Product required by x Product
  • entitled_quantity integer
    Meets the number of y Product s when you get 1 threshold
  • prerequisite_quantity integer
    The number of x Product that is required when 1 threshold is met , and cannot be used at the same time as prerequisite_quantity
  • prerequisite_variant_idsobject[]
    For a Buy X Get Y type discount, a list of IDs of product variants for X products (prerequisites for this discount) cannot be used in combination with prerequisite_collection_ids or prerequisite_product_ids
  • product_id string
    product id
  • variant_id string
    variant id
  • starts_at string required
    Rule start time
  • target_selection string
    Discount rule application range , acceptable value has ● all , defined as all Product ●Entitled , defined as the specify range ( specify Product / specify classification ) when this field is obtained for entitled , the two choices of entitled_product_ids and entitled_collection_ids must be worthwhile ;When target_type=shipping_line , all . default value is all
  • target_type string
    Price rules applicable target type . rms : line_item : price rules applicable to shopping order Product item . shipping_line : price rules applicable to shopping order shipping item .
  • title string required
    The name of the discount rules
  • usage_limit integer
    Limit the total number of uses of all discount codes bound to this discount rule ● If not filled, the default value is null or empty, which means unlimited use times ● Only empty and natural numbers are acceptable; ● If the upper limit value is exceeded, it will be automatically processed as upper limit value
  • usage_per_customer integer
    Limited to each customer can use the number of times per code under the price rule ● if not filled , the default value is lol or empty , refer to the number of times without limited to ● only acceptable to empty and natural ; ● exceeds the upper limit automatic number of times , the number of times to use
  • value string required
    Discount amount or percentage , it must be filled with negative numbers ● if the value_type value is percentage , indicating the Discount percentage , rounding up the reserved whole number , such as : Discount 10 % , filling 10 ; ●If the value_type value is fixed_amount , it means the Discount amount , the unit is yuan , rounded up to retain the two decimal points , such as : Discount 10.23 yuan , fill in the required field of -10.23.
  • value_type string required
    The Discount type , the acceptable value has ● the percentage of percentage , when target_type=shipping_line , you must fill in percentage , buy x and get y type activities must fill in percentage ; ●Fixed_amount fixed amount ; required field
Response
For more information about status codes, see Http status code.

Response Headers
  • traceId
    traceId
Response Body
  • price_ruleobject
    Discount rules
  • allocation_limit integer
    When buying x-d , you can distribute the limited to of the Discount in the shopping cart in the eligible situation . for example , if you are full of 1 piece x and get 1 piece of y discount , set up allocation_limit=2 , when the shopping cart has 3 pieces x Product , and 3
  • allocation_method string
    The distribution method of price rules , the acceptable value has ● each discount , which is suitable for Product in every participation . for example , for Discount price rules of $ 15 , each eligible Product at checkout will be matched Discount $ 15. at this time , the price is about $The discount amount calculated by across will be applied to the entire eligible Product for the price policy of Discount 15 dollars , for example , the discount will be distributed to the Product of each participation event , which is equivalent to $ 15 for the total Discount .When the target_type value is shipping_line , allocation_method must be each. default value across
  • create_at string
    Creation time
  • ends_at string
    Rule end time
  • entitled_collection_ids array
    A list of IDs of products that will be entitled to this discount. ● If target_selection is entitled, then one of entitled_product_ids, entitled_collection_ids, entitled_variant_ids must be defined ● entitled_product_ids, entitled_collection_ids, and entitled_variant_ids are mutually exclusive, only one of them can be defined at the same time. ● A list of IDs of products that will be entitled for a Buy X Get Y type discount (which means list of Y products).
    Example: ``
  • entitled_country_ids array
    Array of country/region ID, temporarily useless
    Example: ``
  • entitled_product_ids array
    A list of IDs of collections that can be applied to the discount. ● If target_selection is entitled, then one of entitled_product_ids, entitled_collection_ids, entitled_variant_ids must be defined ● entitled_product_ids, entitled_collection_ids, and entitled_variant_ids are mutually exclusive, only one of them can be defined at the same time.
    Example: ``
  • entitled_variant_idsobject[]
    A list of IDs of variants that can be applied to the discount. ● If target_selection is entitled, then one of entitled_product_ids, entitled_collection_ids, entitled_variant_ids must be defined ● entitled_product_ids, entitled_collection_ids, and entitled_variant_ids are mutually exclusive, only one of them can be defined at the same time. ● A list of IDs of product variants that will be entitled for a Buy X Get Y type discount (which means list of Y products).
  • product_id string
    product id
  • variant_id string
    variant id
  • id string
    Discount rules id
  • joint_discount boolean
    Whether to superimpose automatic discounts? The default value is false.
  • overlay_discount_code boolean
    Overlay Discount-discount code Discount allowing multiple promo code activities to be superimposed Discount
  • prerequisite_collection_ids array
    For a Buy X Get Y type discount, a list of IDs of collections for X products (prerequisites for this discount) cannot be used in combination with prerequisite_product_ids or prerequisite_variant_ids
    Example: ``
  • prerequisite_customer_ids array
    The premise : customers must belong to one of the search ( customer grouping ) requisite_saved_search_ids , which is saved by specify or one of the customers specify requisite_customer_ids .
    Example: ``
  • prerequisite_product_ids array
    For a Buy X Get Y type discount, a list of IDs of products for X products (prerequisites for this discount) cannot be used in combination with prerequisite_collection_ids or prerequisite_variant_ids
    Example: ``
  • prerequisite_quantity_rangeobject
    Promotion triggers the minimum quantity of items ● prerequisite_quantity_range and prerequisite_subtotal_range are mutually exclusive ● If both are empty, it is the trigger condition for no price or quantity
  • greater_than_or_equal_to integer
    ● nullable ● must be >0 ● only integers are acceptable (integer)
  • prerequisite_saved_search_ids array
    The premise : customers must belong to one of the search ( customer grouping ) requisite_saved_search_ids , which is saved by specify or one of the customers specify requisite_customer_ids .
    Example: ``
  • prerequisite_shipping_price_rangeobject
    Shipping must be less than or equal to the value . * non-required , default null .* 1 ) content * 2 ) is only available in target_type=shipping_line , and the accuracy is consistent with the store currency
  • less_than_or_equal_to string
    Shipping must be less than or equal to the value . * non-required , default null .* 1 ) content 2 ) is only available in target_type=shipping_line , and the accuracy is consistent with the store currency
  • prerequisite_subtotal_rangeobject
    Promotion triggers the minimum order amount ● prerequisite_quantity_range and prerequisite_subtotal_range are mutually exclusive ● If both are empty, it is the trigger condition for no price or quantity
  • greater_than_or_equal_to string
    ● nullable ● rounded to two decimal places
  • prerequisite_to_entitlement_purchaseobject
    When buying x get y , x Product needs to meet the amount threshold
  • prerequisite_amount string
    X Product required amount threshold , not the same as prerequisite_quantity
  • prerequisite_to_entitlement_quantity_ratioobject
    When buying x get y , the number threshold and number of y Product required by x Product
  • entitled_quantity integer
    Meets the number of y Product s when you get 1 threshold
  • prerequisite_quantity integer
    The number of x Product that is required when 1 threshold is met , and cannot be used at the same time as prerequisite_quantity
  • prerequisite_variant_idsobject[]
    For a Buy X Get Y type discount, a list of IDs of product variants for X products (prerequisites for this discount) cannot be used in combination with prerequisite_collection_ids or prerequisite_product_ids
  • product_id string
    product id
  • variant_id string
    variant id
  • starts_at string
    Rule start time
  • target_selection string
    Discount rule application range , acceptable value has ● all , defined as all Product ●Entitled , defined as the specify range ( specify Product / specify classification ) when this field is obtained for entitled , the two choices of entitled_product_ids and entitled_collection_ids must be worthwhile ;● explicit , defined as a single Product , when target_type=shipping_line , you must fill in explicit. default value as all
  • target_type string
    Price rules applicable target type . rms : line_item : price rules applicable to shopping order Product item . shipping_line : price rules applicable to shopping order shipping item .
  • target_user_feature_valuesobject[]
    Return prerequisite_saved_search_ids or prerequisite_customer_ids character value
  • target_value string
    When it is specify customer information and specify customer group information , this value is saved to correspond to the snapshot value of customer / customer group
  • value string
    User value , can be tag id , level information , specify customer information , specify customer group information , etc .
  • title string
    Discount rule id name
  • update_at string
    Update time
  • usage_limit integer
    Limit the total number of uses of all discount codes bound to this discount rule ● If not filled, the default value is null or empty, which means unlimited use times ● Only empty and natural numbers are acceptable; ● If the upper limit value is exceeded, it will be automatically processed as upper limit value
  • usage_per_customer integer
    Limit the number of times a single customer can use each coupon code bound to the discount rule ● If not filled, the default value is null or empty, which means unlimited use times ● Only empty and natural numbers are acceptable; ● If the upper limit value is exceeded, it will be automatically processed as the upper limit value
  • value string
    Discount amount or percentage , it must be filled with negative numbers ● if the value_type value is percentage , indicating the Discount percentage , rounding up the reserved whole number , such as : Discount 10 % , filling 10 ; ●If the value_type value is fixed_amount , it means the Discount amount , the unit is yuan , rounded up to retain the two decimal points , such as : Discount 10.23 yuan , fill in the required field of -10.23.
  • value_type string
    The Discount type , the acceptable value has ● the percentage of percentage , when target_type=shipping_line , you must fill in percentage , buy x and get y type activities must fill in percentage ; ●Fixed_amount fixed amount ; required field
API Explorer
https://openapiceshidianpu.myshopline.com/admin/openapi/v20220601

ParamOptions

— path required
— header required

Body

required
{
  "price_rule": {
    "allocation_limit": 0,
    "allocation_method": "",
    "ends_at": "",
    "entitled_collection_ids": [
      ""
    ],
    "entitled_country_ids": [
      ""
    ],
    "entitled_product_ids": [
      ""
    ],
    "entitled_variant_ids": [
      {
        "product_id": "",
        "variant_id": ""
      }
    ],
    "id": "",
    "joint_discount": false,
    "overlay_discount_code": false,
    "prerequisite_collection_ids": [
      ""
    ],
    "prerequisite_customer_ids": [
      ""
    ],
    "prerequisite_product_ids": [
      ""
    ],
    "prerequisite_quantity_range": {
      "greater_than_or_equal_to": 0
    },
    "prerequisite_saved_search_ids": [
      ""
    ],
    "prerequisite_shipping_price_range": {
      "less_than_or_equal_to": ""
    },
    "prerequisite_subtotal_range": {
      "greater_than_or_equal_to": ""
    },
    "prerequisite_to_entitlement_purchase": {
      "prerequisite_amount": ""
    },
    "prerequisite_to_entitlement_quantity_ratio": {
      "entitled_quantity": 0,
      "prerequisite_quantity": 0
    },
    "prerequisite_variant_ids": [
      {
        "product_id": "",
        "variant_id": ""
      }
    ],
    "starts_at": "",
    "target_selection": "",
    "target_type": "",
    "title": "",
    "usage_limit": 0,
    "usage_per_customer": 0,
    "value": "",
    "value_type": ""
  }
}

Language

curl --request PUT \
--url https://openapiceshidianpu.myshopline.com/admin/openapi/v20220601/sales/price_rules/price_rule_id.json \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw' \
--header 'Content-Type: application/json; charset=utf-8' \
--header 'accept: application/json'
Was this article helpful to you?

Error loading component.

Error loading component.