Update existing price rule
PUT https://{handle}.myshopline.com/admin/openapi/v20230301/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 requiredDiscount rule ID
Request Headers
- Content-Type requiredThe value of this field is fixed to
application/json; charset=utf-8
- Authorization string requiredThe 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 rulesallocation_limit integerWhen 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 3allocation_method stringThe 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 acrossends_at stringRule end timeentitled_collection_ids arrayA 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 arrayArray of country/region ID, temporarily uselessExample: ``entitled_product_ids arrayA 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 stringproduct idvariant_id stringvariant idid stringDiscount rule IDjoint_discount booleanWhether to superimpose automatic discounts? The default value is false.overlay_discount_code booleanOverlay Discount-discount code Discount allowing multiple promo code activities to be superimposed Discountprerequisite_collection_ids arrayFor 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_idsExample: ``prerequisite_customer_ids arrayThe 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 arrayFor 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_idsExample: ``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 quantitygreater_than_or_equal_to integer● nullable ● must be >0 ● only integers are acceptable (integer)prerequisite_saved_search_ids arrayThe 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 currencyless_than_or_equal_to stringShipping 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 accuracyprerequisite_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 quantitygreater_than_or_equal_to string● nullable ● rounded to two decimal placesprerequisite_to_entitlement_purchaseobject
When buying x get y , x Product needs to meet the amount thresholdprerequisite_amount stringX Product required amount threshold , not the same as prerequisite_quantityprerequisite_to_entitlement_quantity_ratioobject
When buying x get y , the number threshold and number of y Product required by x Productentitled_quantity integerMeets the number of y Product s when you get 1 thresholdprerequisite_quantity integerThe number of x Product that is required when 1 threshold is met , and cannot be used at the same time as prerequisite_quantityprerequisite_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_idsproduct_id stringproduct idvariant_id stringvariant idstarts_at string requiredRule start timetarget_selection stringDiscount 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 alltarget_type stringPrice 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 requiredThe name of the discount rulesusage_limit integerLimit 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 valueusage_per_customer integerLimited 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 usevalue string requiredDiscount 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 requiredThe 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
- 200
- 401
- 429
For more information about status codes, see Http status code.
Response Headers
traceId
traceId
Response Body
price_ruleobject
Discount rulesallocation_limit integerWhen 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 3allocation_method stringThe 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 acrosscreate_at stringCreation timeends_at stringRule end timeentitled_collection_ids arrayA 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 arrayArray of country/region ID, temporarily uselessExample: ``entitled_product_ids arrayA 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 stringproduct idvariant_id stringvariant idid stringDiscount rules idjoint_discount booleanWhether to superimpose automatic discounts? The default value is false.overlay_discount_code booleanOverlay Discount-discount code Discount allowing multiple promo code activities to be superimposed Discountprerequisite_collection_ids arrayFor 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_idsExample: ``prerequisite_customer_ids arrayThe 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 arrayFor 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_idsExample: ``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 quantitygreater_than_or_equal_to integer● nullable ● must be >0 ● only integers are acceptable (integer)prerequisite_saved_search_ids arrayThe 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 currencyless_than_or_equal_to stringShipping 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 currencyprerequisite_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 quantitygreater_than_or_equal_to string● nullable ● rounded to two decimal placesprerequisite_to_entitlement_purchaseobject
When buying x get y , x Product needs to meet the amount thresholdprerequisite_amount stringX Product required amount threshold , not the same as prerequisite_quantityprerequisite_to_entitlement_quantity_ratioobject
When buying x get y , the number threshold and number of y Product required by x Productentitled_quantity integerMeets the number of y Product s when you get 1 thresholdprerequisite_quantity integerThe number of x Product that is required when 1 threshold is met , and cannot be used at the same time as prerequisite_quantityprerequisite_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_idsproduct_id stringproduct idvariant_id stringvariant idstarts_at stringRule start timetarget_selection stringDiscount 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 alltarget_type stringPrice 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 valuetarget_value stringWhen it is specify customer information and specify customer group information , this value is saved to correspond to the snapshot value of customer / customer groupvalue stringUser value , can be tag id , level information , specify customer information , specify customer group information , etc .title stringDiscount rule id nameupdate_at stringUpdate timeusage_limit integerLimit 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 valueusage_per_customer integerLimit 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 valuevalue stringDiscount 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 stringThe 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
Debugger
Was this article helpful to you?
Error loading component.