Skip to content
Tutorials Center
My learning

Topics

Lesson 21 of 40 ยท Shipping and Fulfillment

Shipping Methods and Rates

Learn how shops calculate shipping: flat rates, weight and zone tables, free-shipping thresholds, dimensional weight, carrier rate APIs, delivery estimates, pickup and duties.

Shipping is where an online sale meets the physical world, and it is one of the biggest reasons carts are abandoned. Customers who are surprised by a high shipping cost at the last step often leave. At the same time, shipping costs the shop real money, and a rate that is too low can turn a profitable order into a loss. A good shipping setup is therefore both a pricing problem and a user-experience problem.

In this lesson you will learn the common ways of calculating shipping, what a shipping method is, how carrier rate APIs fit in, how dimensional weight changes the numbers, and how to show delivery estimates. All money values are integer minor units (cents), as in Representing Money Correctly. The rate calculation happens during checkout, after the customer has entered an address, as described in Checkout Flow and Conversion.

Methods, zones and rates

Three words appear in almost every shipping system:

  • A shipping zone is a group of destinations that are priced the same way, for example "Domestic", "Europe", "Rest of world". A zone is usually a list of countries, regions or postal-code ranges.
  • A shipping method is a service a customer can choose, such as "Standard (3-5 days)", "Express (next day)" or "Store pickup".
  • A shipping rate is the price for a method in a zone under certain conditions (order weight, order value, item count).

The system receives the cart and the destination, finds the zone, lists the methods that apply, and calculates a price for each. The customer picks one, and that price becomes a line in the order totals. Always store the chosen method name, price and any tax on the order, so later changes to your rates cannot rewrite history. This is the same snapshot idea you saw in The Order Lifecycle and State Machines.

flowchart LR
    A["Cart + address"] --> B["Find zone"]
    B --> C["List methods for zone"]
    C --> D["Calculate each rate"]
    D --> E["Customer chooses one"]
    E --> F["Snapshot on the order"]

Shipping is calculated from the cart and destination, and the chosen result is copied onto the order.

Common rate models

Flat rate. One price per order, per method: "$5.00 for standard". It is simple to explain and to build. It works well when parcels are similar in size and the shop can average the costs.

Per item. A price per unit, or per unit after the first. Useful for small, uniform goods, but it punishes big baskets.

Weight-based tables. A table maps weight ranges to prices, often one table per zone. This is the most common model for physical goods because carriers price by weight.

Order-value based. Price depends on how much the customer spends, for example "$6 under $50, $3 from $50 to $100, free above $100".

Free-shipping threshold. Free standard shipping above a cart total. It encourages bigger baskets, and showing "You are $12 away from free shipping" in the cart is a well-known way to raise the average order value. Decide whether the threshold applies before or after discounts. Using the total after discounts is the safer rule, because otherwise a coupon could push an order below the threshold after the customer saw "free".

Real-time carrier rates. Your shop sends the parcel details and addresses to the carrier's rate API (or to an aggregator that connects to many carriers) and shows the answer. This gives accurate prices for varied products, but it adds a network call to checkout. Cache results, set a short timeout, and have a fallback table for when the API is down.

Pickup and local delivery. "Click and collect" has no carrier cost. It needs a list of pickup locations, opening hours, and stock that is tracked per location, like in Inventory Tracking.

A weight-and-zone rate table

Here is a small calculator. It finds the zone for a country, then looks up the first weight band whose limit is at least the parcel's weight. Prices are in cents, weights in grams. The calculator returns every available method, including the free-shipping rule and a pickup option.

JS Zones, weight bands and a free-shipping threshold

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Look at the last two carts. A parcel heavier than the table, and a country outside every zone, return no options. Your checkout must handle that case clearly ("We cannot ship this to your address") instead of showing an empty list or a price of zero.

Weight, size and dimensional weight

Carriers charge for the larger of two numbers: the actual weight of the parcel and its dimensional weight (also called volumetric weight). Dimensional weight reflects how much space a parcel takes in a truck or plane. It is calculated as:

TEXT
dimensional weight = length x width x height / divisor

The divisor depends on the carrier and the units. Common examples are 5000 for centimeters and kilograms and 139 for inches and pounds, but check your carrier's current rules because they change. The billable weight is max(actual, dimensional). A large, light pillow can be billed as if it were a heavy box.

For this reason, store weight and dimensions on every shippable variant (see Variants and Options), choose boxes in your fulfillment process, and consider that the packaged weight includes the box and padding. Digital goods and services need no shipping, so mark products as shippable or not.

JS Billable weight and a carrier fallback

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The pillow weighs 1.2 kg but is billed as 18.0 kg. Surprises like that are why guessing rates from product weight alone often goes wrong.

Carrier rate APIs

When rates vary a lot, you ask the carrier. A typical request contains the origin, destination, parcel weight and dimensions, and requested services. The response lists services with a price and often a delivery estimate. A few practical points:

  • Latency. A rate call can take a second or more. Request rates only after a complete address is entered, call carriers in parallel, and give up after a short timeout.
  • Account rates vs list prices. The price you pay is your negotiated rate. The price you charge the customer is a business decision: pass it on, add a handling fee, round up, or subsidize.
  • Rate shopping. Aggregators or your own code can compare carriers and pick the cheapest that meets the promised delivery time.
  • Labels. Buying a rate usually creates a shipping label and tracking number later, at fulfillment time (see Fulfillment, Returns and Refunds). The quote at checkout is only a quote.
  • Address quality. Rates depend on valid postal codes. Validate addresses first, as discussed in the checkout lesson.

Delivery estimates

Customers care about "when", not only "how much". An estimate combines the handling time (how long you need to pick and pack, including your cut-off time for same-day dispatch) with the transit time of the method. Skip weekends and holidays as the carrier does. Be honest and show a range ("Arrives Sep 12-15"). A promise you miss costs more support time than a slightly longer promise you keep. When stock is on backorder or a preorder, the estimate must use the restock date instead.

International shipping, duties and taxes

Shipping abroad adds customs. Duties are import charges based on the goods and the destination; import VAT or GST may also apply. Two models exist:

  • DAP (delivered at place): the customer pays duties and taxes to the carrier on delivery. This is cheap for the shop but a nasty surprise for the buyer, and unpaid parcels may be returned.
  • DDP (delivered duty paid): the shop collects duties and taxes at checkout and pays them for the customer. The buyer sees one final price, which converts better, but you must calculate them correctly.

Products need a harmonized system (HS) code, a country of origin and a declared value for customs forms. Some goods are restricted or banned in certain countries. This lesson only introduces the topic; rules change often and vary by country, so check with your carrier or a customs specialist. Tax handling at checkout is covered in Sales Tax, VAT and GST.

Design tips

  • Show shipping cost as early as possible: a calculator on the product or cart page ("Estimate shipping") removes the last-step shock.
  • Offer a clear default and not more than three or four methods.
  • Keep rule changes versioned and test them with real baskets, since a typo in a rate table silently costs money.
  • Treat shipping as a separate line item with its own tax class, since some places tax shipping and others do not.
  • Round and store in minor units; never use floating-point arithmetic for rates.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What is a shipping zone?

    Zones group countries, regions or postal-code ranges so one rate table can apply to all of them. Methods are the services offered inside a zone.
  2. 2. A pillow weighs 1.2 kg but its volumetric weight is 18 kg. What weight is normally billed?

    Carriers charge the greater of actual and dimensional weight, because bulky parcels use more space even when they are light.
  3. 3. Should a free-shipping threshold be checked against the subtotal before or after discounts?

    Using the discounted subtotal keeps the rule predictable. Whatever you choose, show it clearly and apply it consistently.
  4. 4. What should checkout do if the carrier rate API times out?

    A short timeout and a fallback rate protect conversion. Free shipping would lose money, and refusing the order loses the sale.
  5. 5. What is the main difference between DAP and DDP for international orders?

    DDP gives the buyer one final price; DAP leaves duties and taxes to be paid when the parcel arrives, which can surprise the customer.

Summary

  • A shipping zone groups destinations, a method is a service the customer can pick, and a rate is the price for a method under certain conditions.
  • Common models: flat, per item, weight tables, order-value tables, free-shipping thresholds, real-time carrier rates and pickup.
  • Carriers bill the larger of actual and dimensional weight, so store weights and dimensions for shippable variants.
  • Handle the no-options case clearly, use timeouts and fallbacks for carrier APIs, and snapshot the chosen method and price on the order.
  • Estimates combine handling time and transit time; show honest ranges.
  • International orders involve duties and import taxes; decide between DAP and DDP and keep product customs data.

Next: Fulfillment, Returns and Refunds follows the parcel from the warehouse shelf and back again.