Delivery Pricing Bands
Intro
Delivery pricing bands allow you to discount the delivery charge paid by the customer for ranges of basket values (i.e. subtotal with discounts applied). They can be set up in Controls.
Listing all bands
To get a list of all bands for a store use the following query:
query GetDeliveryPricingBands($storeId: uuid!, $orderType: OrderType!) {
getDeliveryPricingBands(storeId: $storeId, orderType: $orderType) {
lowerThreshold
upperThreshold
percentageDiscount
}
}
Variables:
{
"storeId": "4fe810ed-db3c-4055-b61d-ecb567dc7196",
"orderType": SAMEDAY
}
Example output:
{
"data": {
"getDeliveryPricingBands": [
{
"lowerThreshold": "20",
"percentageDiscount": 25,
"upperThreshold": "30"
},
{
"lowerThreshold": "30",
"percentageDiscount": 50,
"upperThreshold": "40"
},
{
"lowerThreshold": "40",
"percentageDiscount": 100,
"upperThreshold": null
}
]
}
}
Where lower threshold is the minimum basket value required for the band to apply and upper threshold is the maximum basked value at which the band can apply. If upper threshold is null then there is no upper limit.
Getting applied bands
To see what band has been applied to a cart add the following fragment on any mutation or query which returns the cart type (e.g. updateSlerpCart
, applyDiscount
, applyAutomaticDiscount
, quoteAndUpdateAddress
and getSlerpCart
):
query GetSlerpCart($cartId: uuid!) {
getSlerpCart(cartId: $cartId) {
deliveryChargeInfo {
deliveryChargeReduction
deliveryChargeReductionReason
deliveryPricingBand {
lowerThreshold
upperThreshold
percentageDiscount
}
}
}
}
Example output:
{
"data": {
"getSlerpCart": {
"deliveryChargeInfo": {
"deliveryChargeReduction": "0.87",
"deliveryChargeReductionReason": "DELIVERY_PRICING_BAND",
"deliveryPricingBand": {
"lowerThreshold": "20",
"percentageDiscount": 25,
"upperThreshold": "30"
}
}
}
}
}