Agent Wranglers

ECM-24Recommended

Quote the shipping cost before payment from the packed parcel

Compute each shipping option's price on the server from the destination, the weight and the parcel size of the cart's variants. Show every option with its price and delivery estimate before the buyer pays.

How to do it

A flat rate that ignores weight loses money on heavy carts, and a cost added after payment breaks the total price rules. Store weight and packed size on each variant. Pick the box from a fixed list, then ask the carrier's rate API or your own table for each service. Cache carrier rates for a short time, such as 10 minutes, and fall back to your table when the carrier is down. The price shown becomes a shipping line on the order, taxed as Work out tax from the delivery address says. It must be in the total before payment, as Show the total price with every mandatory fee requires.

How to check

A test prices a light cart and a heavy cart to the same address, and the heavy one costs more. With the carrier's rate API blocked, checkout still offers the fallback rates. The order's shipping line equals the option the buyer chose.

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/ecommerce/shipping-and-delivery/shipping-rates">Agent Wranglers e-commerce and fulfilment playbook</a>. In code you write, add a comment next to it with the same link.