door Liang Yufeng 2 jaren geleden
98
Meer zoals dit
https://www.figma.com/file/lcAiv9quIJybAT09WtMD42/Cart-Bundling%2FLinking?node-id=751%3A330
https://secretlabsg.slack.com/files/U02BXMH4T1P/F03BBBPEA9Y/image_from_ios.jpg
problem:
price_overwrite
to overwrite the original price,
if set to 0 means this is free
should_remove_exceeded
if the quantity in cart exceed the max quantity, should remove the exceeded quantity?
auto_add
is_main
value
max quantity
min quantity
variant_id
id
this id is sku list item id, not present in UI.
the primary key is also used for multiple same sku item do sales like buy 1 get the same 1 free or buy 1 get the same one at 50% discount.
maximum
minimum
does this bundle rule can be stack with other bundle rules?
not on sales price
0:highest
-
10: lowest
end_time
start_time
amount
type
has_discount
limited
customer optional to add sub product
mandatory
n+m
auto add sub product
has main product
optional
> 2 skus
check for existence
selectable
Checkout cart
Method:Post
validation
no draft order id
create draft order
https://shopify.dev/api/admin-rest/2021-10/resources/draftorder#post-draft-orders
- use line item discount
has draft order id
update draft order
return error
checkout url
draft order id
nullable
has_bundle: boolean
does the cart object fit into any bundle rule?
cart_items: array
skus and its discount amount
error: array
skus needs to be removed
skus needs to be added
{
"has_bundle": true,
"cart_items": [
{
"sku": "2022",
"discounted_amount":0,
},
{
"sku": "2022",
"discounted_amount":10,
},
{
"sku": "2022",
"discounted_amount":10,
}
],
"error":[
{
"sku": "2022",
"add":1,
"deduct":0,
"message":""
]
]
Cart Page
Method:Post
the response is same as product page, it is just giving more rules by multiple skus
cart object
Shopify Cart Object
Product Page
Method:Get
rule 1:
[
{
"bundle_name":"A",
"bundle_type":"1",
"priority":1,
"stackable":false,
"has_discount":true,
"discount_type":"value",
"discount_value":20.00,
"minimum_quantity":3,
"maximum_quantity":0,
"variants":[
{
"id":1,
"variant_id":100,
"sku":"2022",
"minimum_quantity":1,
"maximum_quanity":1,
"is_main":false,
"auto_add":false,
"has_discount":false,
"discount_type":null,
"discount_value":null
},
{
"id":2,
"variant_id":101,
"sku":"wiper",
"minimum_quantity":1,
"maximum_quanity":0,
"is_main":false,
"auto_add":false,
"has_discount":false,
"discount_type":null,
"discount_value":null
}
]
}
]
---------------------------------------
rule 2:
[
{
"bundle_name":"A",
"bundle_type":"2",
"priority":1,
"stackable":false,
"has_discount":"ture",
"discount_type":"value",
"discount_value":20.00,
"minimum_quantity":3,
"maximum_quantity":0,
"variants":[
{
"id":1,
"variant_id":100,
"sku":"2022",
"minimum_quantity":1,
"maximum_quanity":1,
"is_main":true,
"auto_add":false,
"has_discount":false,
"discount_type":null,
"discount_value":null
},
{
"id":2,
"variant_id":101,
"sku":"wiper",
"minimum_quantity":1,
"maximum_quanity":1,
"is_main":false,
"auto_add":true,
"has_discount":false,
"discount_type":null,
"discount_value":null
}
]
}
]
---------------------------------------
rule 3:
[
{
"bundle_name":"A",
"bundle_type":"3",
"priority":1,
"stackable":false,
"has_discount":"ture",
"discount_type":"percentage",
"discount_value":10,
"minimum_quantity":3,
"maximum_quantity":3,
"variants":[
{
"id":1,
"variant_id":100,
"sku":"2022",
"minimum_quantity":1,
"maximum_quanity":1,
"is_main":true,
"auto_add":false,
"has_discount":false,
"discount_type":null,
"discount_value":null
},
{
"id":2,
"variant_id":101,
"sku":"dry-wiper",
"minimum_quantity":0,
"maximum_quanity":2,
"is_main":false,
"auto_add":false,
"has_discount":false,
"discount_type":null,
"discount_value":null
},
{
"id":3,
"variant_id":102,
"sku":"wet-wiper",
"minimum_quantity":0,
"maximum_quanity":2,
"is_main":false,
"auto_add":false,
"has_discount":false,
"discount_type":null,
"discount_value":null
}
]
}
]
sku