International shipping rates are configured (if applicable)
Why it matters
An address form that accepts 12 countries but routes every order through a domestic shipping rate table charges Canadian customers the same flat US rate as Los Angeles — producing direct financial losses when shipping a package to Toronto for $12 that actually costs $34. The store either absorbs the loss or charges the customer incorrectly. CWE-682 (Incorrect Calculation) applies when a country parameter is accepted by the address form but silently ignored by the shipping calculation. International expansion is invalidated if the first cross-border order ships at a domestic rate.
Severity rationale
Low because the defect only affects international orders, but within that segment it produces predictable per-order financial losses or customer overcharges that scale with international traffic.
Remediation
Add a country branch to the shipping calculation in lib/shipping.ts:
// lib/shipping.ts
async function getShippingRate(
destination: Address,
method: ShippingMethod,
items: OrderItem[]
): Promise<number> {
if (destination.country === 'US') {
return getDomesticRate(destination.state, method, items)
}
// International: delegate to carrier API for live rates
const shipment = await easypost.shipment.create({
to_address: {
country: destination.country,
city: destination.city,
zip: destination.zip,
},
parcel: {
weight: items.reduce((sum, i) => sum + i.weight * i.quantity, 0),
},
})
return Number(shipment.rates[0].rate) * 100
}
If carrier API integration is out of scope, restrict the address form's country dropdown to domestic only rather than silently applying domestic rates to international addresses.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Shipping & Tax Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- external · iata-dangerous-goods-regulations — IATA Dangerous Goods Regulations and carrier-specific international shipping rate zones (UPS, FedEx, DHL international zone maps)
- cwe · CWE-682 — Incorrect Calculation
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ecommerce-shipping-tax·automated