Home
Blog
Product

Tiered Shipping Option Pricing

Dec 13, 2024 by

Riqwan Thamir

Riqwan avatar

Riqwan Thamir

Easily create tiered shipping prices based on cart items - including setting free shipping rules.

Image modal

We are excited to add more powerful pricing features to Medusa's shipping management. With this launch, you can now set prices for shipping options based on the cart's item total that allows your business to incentivize customers to add more items to the cart.

You can now easily add support for prices like 30% reduction on orders over X and free shipping on orders over Y.

This launch comes with a new extension to our already powerful bulk editor to create custom shipping prices based on rules.

We have also updated both of our commerce starters (B2B & DTC) to include free shipping components that tell your customers how much more they need to add to their cart to enable free shipping.

Support of Advanced Pricing Rules

The pricing module already allows setting a combination of rules to enable a price for a resource. Here's an example of a price for a customer group.

await pricingModule.addPrices({
priceSetId: "pset_1",
prices: [{
currency_code: "usd",
amount: 100,
rules: {
"customer.group.id": "cusgp_1",
}
}]
})

We have now added operators into the mix to make pricing rule logic more powerful. Here is an example of a price for a customer group if the cart's item total is greater than 1,000.

await pricingModule.addPrices({
priceSetId: "pset_1",
prices: [{
currency_code: "usd",
amount: 0,
rules: {
"customer.group.id": "cusgp_1",
"item_total": {
"operator": "gt",
"value": 1000
}
}
}]
})

When calculating prices, we have added operators into our price-selection strategy to now account for these complex rules.

Rule Operator for Shipping Option APIs

The shipping option APIs can already create and update currency and region prices. With this launch, the shipping option APIs can now accept more complex rule operators for region and currency prices.

// POST /admin/shipping_options
// POST /admin/shipping_options/:id
// Body
{
...,
"prices": [{
"currency_code": "usd",
"rules": [
{
operator: "gt",
attribute: "item_total",
value: 1000
}
]
}]
}

When querying Copy to clipboardGET /admin/shipping_options?cart_id=cart_1 endpoint, we will now account for these custom shipping prices when calculating prices.

Support in the Admin

Our bulk pricing editor was already powerful. With this launch, we see this being extended to include prices with more complex rules than what was previously supported.

By hovering over the cell, you will see a new button that opens a layered modal where you can set custom shipping prices. You can create as many tiered shipping prices as you need, including free shipping, by setting the amount to 0.

Starter Support

Now that all the individual pieces are working in unison, we can showcase this feature in the starter to nudge customers to add more items to the cart to unlock free shipping.

We've updated both our B2B and DTC starters to include this feature by default. You just need to set up a free shipping price and a component popup in your storefront.

Share this post

Try Medusa

Spin up your environment in a few minutes.