Public APIs for Quantity Breaks (QB)
Last updated
Last updated
After you install B2B/Wholesale Solution Shopify app. Go to Public API page, click on the Copy button.
There are fields of rule, you need to understand: - priority: decides whether a rule is prioritized over another or not. - status:
0: inactive
1: active
- apply_to:
0: All customers
1: Logged-in customers
2: Not-logged-in customers
3: Specific customers
4: Customer tags
- exclude_customer:
0: None
1: Customer tags
2: Specific customers
- product_condition_type:
0: All products
1: Specific products
2: Product collections
3: Product tags
4: Specific variants
- exc_product_type:
0: None
1: Specific products
2: Product collections
3: Product tags
- rule_setting:
0: Quantity break
1: Amount break
- qb_table_type:
0: Full range & Discounts
1: Full range & Discounted prices
2: From & Discounts
3: From & Discounted prices 1
4: From & Discounted prices 2
5: From & Discounts with Discounted prices 1
6: From & Discounts with Discounted prices 2
7: Legacy 1
8: Legacy 2
Note:
When request get rules by domain or ID, the rule_setting field will appear at the response to inform you whether your rule is Quantity Break or Amount Break.
However, when send request Create/Update rule the rule_setting will be Quantity Break by default as we haven't support create/update Amount Break as of date.
- qty_table: Quantity settings of rule + rule_type:
0: Minimum Product Qty
1: Minimum Order Qty
2: Minimum Variant Qty
- Minimum Product Qty:
If one order contains the selected products and the number of each product meets the quantity break ranges, the price of the product will be discounted accordingly.
For example:
You choose products A and B to apply the quantity break rule. A has two variants: A1, A2. B also has two variants B1, B2.
The order quantity break ranges are from 0 to 5 (discounted 10%) and from 6 to 10 (discount 15%)
That time, if the customer buys 3 A1, 6 A2 and 4 B1. The total quantity of A is 9 so the price of A will be discounted by 15%. The price of B, however, will be discounted by 10%.
If the quantity of the order/product(s)/variant(s) is not within the ranges, the original prices are applied.
- Minimum Order Qty:
If one order contains the selected products and the total number of those products meets the quantity break ranges, they will be discounted accordingly.
For example:
You choose products A and B to apply the quantity break rule. A has two variants: A1, A2. B also has two variants B1, B2.
The order quantity break ranges are from 0 to 5 (discounted 10%) and from 6 to 10 (discount 15%) and from 11 to 20 (discount 20%)
That time, if the customer buys 3 A1, 6 A2 and 4 B1. The total quantity of A and B is 13, meaning that the prices of A and B will be discounted by 20%.
If the quantity of the order/product(s)/variant(s) is not within the ranges, the original prices are applied.
- Minimum Variant Qty :
If one order contains the selected products and the number of variants meets the quantity break ranges, the price of those variants will be discounted accordingly.
For example:
You choose products A and B to apply the quantity break rule. A has two variants: A1, A2. B also has two variants B1, B2.
The order quantity break ranges are from 0 to 5 (discounted 10%) and from 6 to 10 (discount 15%) and from 11 to 20 (discount 20%)
That time, if the customer buys 3 A1, 6 A2 and 4 B1. Then, the prices of A1 and B1 will be discounted by 10% and that of A2 will be discounted by 15%.
If the quantity of the order/product(s)/variant(s) is not within the ranges, the original prices are applied.
+ qty_from: The order quantity break ranges are from qty_from to qty_to + qty_to: The order quantity break ranges are from qty_from to qty_to + discount_type:
0: Apply a price to selected products
1: Decrease a fixed amount of the original prices of selected products
2: Decrease the original prices of selected products by a percentage (%)
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/get-by-domain
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx"
}
Response
{
"success": true,
"rules": [
{
"id": 9792,
"shop_id": 9204,
"name": "sencond1",
"priority": 0,
"rule_type": 2,
"rule_setting": 0,
"status": 1,
"apply_to": 0,
"customer_ids": [],
"customer_tags": [],
"product_condition_type": 0,
"product_ids": [],
"product_collections": [],
"product_tags": [],
"varianst_id": [],
"exc_product_type": 1,
"exc_specific_products":
[
6669588136111,
6669469352111
],
"exc_product_collections": [],
"exc_product_tags": [],
"published_at": null,
"unpublished_at": null,
"exc_customer_tags": "",
"exclude_from": 0,
"exc_customers": "",
"qb_table_type": 3,
"createdAt": "2023-03-09T02:27:26.000Z",
"updatedAt": "2023-05-30T04:29:18.000Z",
"qbRuleQtyTables": [
{
"id": 33022,
"rule_id": 9792,
"qty_from": 1,
"qty_to": 4,
"discount_type": 0,
"discount_value": 10,
"createdAt": "2023-05-26T04:26:21.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z"
},
{
"id": 33023,
"rule_id": 9792,
"qty_from": 6,
"qty_to": 8,
"discount_type": 1,
"discount_value": 10,
"createdAt": "2023-05-26T04:26:21.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z"
}
],
"abRuleQtyTables": []
},
{
"id": 9909,
"shop_id": 9204,
"name": "sencond2",
"priority": 0,
"rule_type": 2,
"rule_setting": 0,
"status": 1,
"apply_to": 0,
"customer_ids": [],
"customer_tags": [],
"product_condition_type": 4,
"product_ids": [],
"product_collections": [],
"product_tags": [],
"variants_ids":
[
4908909872990,
8799990863829
],
"exc_product_type": 0,
"exc_specific_products": [],
"exc_product_collections": [],
"exc_product_tags": [],
"published_at": null,
"unpublished_at": null,
"exc_customer_tags": null,
"exclude_from": 0,
"exc_customers": null,
"qb_table_type": 0,
"createdAt": "2023-03-13T09:39:48.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z",
"qbRuleQtyTables": [
{
"id": 33024,
"rule_id": 9909,
"qty_from": 1,
"qty_to": 4,
"discount_type": 0,
"discount_value": 10,
"createdAt": "2023-05-26T04:26:21.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z"
},
{
"id": 33025,
"rule_id": 9909,
"qty_from": 6,
"qty_to": 8,
"discount_type": 1,
"discount_value": 11,
"createdAt": "2023-05-26T04:26:21.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z"
}
],
"abRuleQtyTables": []
}
]
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/get-by-id
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"id": 46
}
Response
{
"success": true,
"rule": {
"id": 46,
"name": "sencond1",
"priority": 0,
"status": 1,
"apply_to": 0,
"customer_ids": [],
"customer_tags": [],
"exclude_from": 0,
"exc_customers": [],
"exc_customer_tags": [],
"product_condition_type": 0,
"product_ids": [],
"product_collections": [],
"product_tags": [],
"variant_ids": [],
"exc_product_type": 3,
"exc_specific_products": [],
"exc_product_tags":
[
"babytshirt",
"gaminggear"
],
"exc_product_collections": []
"rule_setting": 0,
"rule_type": 2,
"qty_table": [
{
"id": 33022,
"rule_id": 9792,
"qty_from": 1,
"qty_to": 4,
"discount_type": 0,
"discount_value": 10,
"createdAt": "2023-05-26T04:26:21.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z"
},
{
"id": 33023,
"rule_id": 9792,
"qty_from": 6,
"qty_to": 8,
"discount_type": 1,
"discount_value": 10,
"createdAt": "2023-05-26T04:26:21.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z"
}
],
"amount_table": [],
"qb_table_type": 3,
"createdAt": "2023-03-09T02:27:26.000Z",
"updatedAt": "2023-05-30T04:29:18.000Z"
}
}
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/save
Headers
Content-Type
application/json
Body
If there is no ID in the request data, a new rule will be created. Otherwise, the existing rule with ID will be updated.
If "product_condition_type" is 4 (specific variants), then rule_type should not be 0 (minimum product qty)
{
"domain":"abc.myshopify.com",
"accessKey": "xxx",
"rule": {
"id": 11,
"name": "sencond1",
"priority": 0,
"status": 1,
"apply_to": 0,
"customer_ids": [],
"customer_tags": [],
"exclude_from": 0,
"exc_customers": [],
"exc_customer_tags": [],
"product_condition_type": 0,
"product_ids": [],
"product_collections": [],
"product_tags": [],
"variant_ids": [],
"exc_product_type": 1,
"exc_specific_products":
[
4766764787771,
4766764787752,
],
"exc_product_tags": [],
"exc_product_collections": [],
"rule_setting": 0,
"rule_type": 2,
"qty_table": [
{
"qty_from": 1,
"qty_to": 4,
"discount_type": 0,
"discount_value": 10
},
{
"qty_from": 6,
"qty_to": 8,
"discount_type": 1,
"discount_value": 10
}
],
"amount_table": [],
"qb_table_type": 1
}
}
Response
{
"success": true,
"ruleId": 11,
"message": "Updated the rule successfully"
}
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/bulk-save
Headers
Content-Type
application/json
Body
If there is no ID in the request data, a new rule will be created. Otherwise, the existing rule with ID will be updated. If ID is incorrect or not found in one/multiple rules within the body, the rules will not be created/updated successfully.
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"rules": [
{
"name": "sencond1",
"priority": 0,
"status": 1,
"apply_to": 0,
"product_condition_type": 0,
"customer_ids": [],
"customer_tags": [],
"product_ids": [],
"product_collections": [],
"product_tags": [],
"variant_ids": [],
"exc_customer_tags": "",
"exclude_from": 0,
"exc_customers": "",
"exc_product_type": 0,
"exc_specific_products": [],
"exc_product_tags": [],
"exc_product_collections": [],
"rule_type": 2,
"rule_setting": 0,
"qty_table": [
{
"qty_from": 1,
"qty_to": 4,
"discount_type": 0,
"discount_value": 10
},
{
"qty_from": 6,
"qty_to": 8,
"discount_type": 1,
"discount_value": 10
}
],
"amount_table": [],
"qb_table_type": 4
},
{
"id": 9909,
"name": "sencond2",
"priority": 0,
"status": 1,
"apply_to": 0,
"product_condition_type": 0,
"customer_ids": [],
"customer_tags": [],
"product_ids": [],
"product_collections": [],
"product_tags": [],
"variant_ids": [],
"exc_customer_tags": "",
"exclude_from": 0,
"exc_customers": "",
"exc_product_type": 2,
"exc_specific_products": [],
"exc_product_collections":
[
265680552111,
318279188655,
318279254191,
318279221423,
265681010863
],
"exc_product_tags": [],
"rule_type": 2,
"rule_setting": 0,
"qty_table": [
{
"qty_from": 1,
"qty_to": 4,
"discount_type": 0,
"discount_value": 10
},
{
"qty_from": 6,
"qty_to": 8,
"discount_type": 1,
"discount_value": 11
}
],
"amount_table": [],
"qb_table_type": 4
}
]
}
Response
{
"success": true,
"message": [
"Rule second1 has been created successfully",
"Rule second2 has been updated successfully"
]
}
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/delete
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"id": 79
}
Response
{
"success": true,
"message": "Deleted rule successfully"
}
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/mass-delete
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"ids": [79,80,81]
}
Response
{
"success": true,
"message": "Deleted multiple qb rule successfully"
}
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/get-products-applied-rules
Headers
Content-Type
application/json
Body
If customer_id is null, the system will check Quantity Break Rules which applied for all customers or not-logged-in customers.
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"product_ids": [6103930831040,6103930929344],
"customer_id": 5110452355264
}
Response
{
"success": true,
"productsAppliedRule": [
{
"id": "6103930831040",
"rule_name": "first",
"rule_id": 51,
"qty_table": [
{
"id": 47,
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"createdAt": "2021-09-16T08:41:14.000Z",
"updatedAt": "2021-09-16T08:41:14.000Z"
},
{
"id": 48,
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"createdAt": "2021-09-16T08:41:14.000Z",
"updatedAt": "2021-09-16T08:41:14.000Z"
}
]
},
{
"id": "6103930929344",
"rule_name": "first",
"rule_id": 51,
"qty_table": [
{
"id": 47,
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"createdAt": "2021-09-16T08:41:14.000Z",
"updatedAt": "2021-09-16T08:41:14.000Z"
},
{
"id": 48,
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"createdAt": "2021-09-16T08:41:14.000Z",
"updatedAt": "2021-09-16T08:41:14.000Z"
}
]
}
]
}
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/get-variants-price-list
Headers
Content-Type
application/json
Body
If customer_id is null, the system will check Custom Pricing Rules which applied to all customers or not-logged-in customers.
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"product_ids": [
6103930831040,
6103930929344
],
"customer_id": 5110452355264
}
Response
{
"success": true,
"priceList": [
{
"id": "6103930831040",
"rule_name": "first",
"rule_id": 52,
"variants": [
{
"id": "37682508955840",
"price": "36.00",
"compareAtPrice": null,
"appliedRulePrice": [
{
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"modifiedPrice": 90
},
{
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"modifiedPrice": 10
}
]
}
]
},
{
"id": "6103930929344",
"rule_name": "first",
"rule_id": 52,
"variants": [
{
"id": "37682509086912",
"price": "100.00",
"compareAtPrice": "80.00",
"appliedRulePrice": [
{
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"modifiedPrice": 90
},
{
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"modifiedPrice": 10
}
]
},
{
"id": "37682509119680",
"price": "100.00",
"compareAtPrice": null,
"appliedRulePrice": [
{
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"modifiedPrice": 90
},
{
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"modifiedPrice": 10
}
]
},
{
"id": "37682509152448",
"price": "100.00",
"compareAtPrice": null,
"appliedRulePrice": [
{
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"modifiedPrice": 90
},
{
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"modifiedPrice": 10
}
]
},
{
"id": "37682509185216",
"price": "100.00",
"compareAtPrice": null,
"appliedRulePrice": [
{
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"modifiedPrice": 90
},
{
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"modifiedPrice": 10
}
]
}
]
}
]
}
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/product/search
Headers
Content-Type
application/json
Body
Index is a cursor value, where you want to start searching. If afterIndex is null, the system will search products from the beginning. For example:
afterIndex: "eyJsYXN0X2lkIjo2NjU1NDU2Mzc5MDUzLCJsYXN0X3ZhbHVlIjo2NjU1NDU2Mzc5MDUzfQ=="
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"afterIndex": null,
"first": 20,
"searchQuery": "ocean"
}
Response
{
"success":true,
"productList":{
"edges":[
{
"node":{
"id":"gid://shopify/Product/6586580271277",
"title":"Ocean Blue Shirt",
"handle":"ocean-blue-shirt",
"productType":"",
"totalVariants":1,
"hasOnlyDefaultVariant":true,
"priceRange":{
"minVariantPrice":{
"currencyCode":"VND",
"amount":"50.0"
},
"maxVariantPrice":{
"currencyCode":"VND",
"amount":"50.0"
}
},
"featuredImage":{
"transformedSrc":"https://cdn.shopify.com/s/files/1/0538/3874/1677/products/young-man-in-bright-fashion_925x_5251bcfa-6939-4d7a-9287-dd9bf058ed03.jpg?v=1616405807"
},