v2.0

GoRules Version 2 is here - redesigned, now with managed cloud.GoRules Version 2 is here!

Watch the launch videoWatch

Dynamic Shipping Cost Calculator

Advanced shipping rate system that automatically calculates costs based on shipment attributes, seasonal variables, and customer loyalty tiers.

Solution

This shipping cost calculator delivers accurate and fair pricing by evaluating multiple shipment variables simultaneously. Starting with the base rate determined by shipping type (standard, express, or priority) and weight brackets, the system applies dimensional weight calculations to account for bulky but lightweight items. Distance is factored in proportionally to capture fuel and operational costs that increase with delivery range.

The calculator recognizes customer loyalty with built-in tier discounts for platinum, gold, and silver members, providing transparent benefits for repeat business. Seasonal adjustments are automatically applied for summer peak periods and winter weather challenges, ensuring prices reflect actual operational costs throughout the year. This multi-factor approach creates balanced shipping quotes that benefit both the carrier and customer with fair, predictable pricing.

How it works

The decision graph processes shipping information through four connected components:

  1. Base Rate Calculation: Determines initial pricing using shipping type (standard, express, priority) and weight brackets.
  2. Season Detection: Identifies the current time of year (winter, summer, regular) based on day number to apply appropriate seasonal factors.
  3. Shipping Factors: Calculates dimensional weight by comparing actual weight against volume-based weight (length × width × height ÷ 5000), and determines distance factors for mileage pricing.
  4. Final Price Calculation: Combines all previous factors with customer tier discounts (platinum, gold, silver) to produce the final shipping cost with adjustments for both seasonal challenges and customer loyalty.

Where teams use it

  • E-commerce shipping rate calculators
  • Logistics company pricing systems
  • Warehouse management software
  • Supply chain management platforms
  • Customer service shipping quote tools
  • International shipping operations

Inside the decision model

Dynamic Shipping Cost Calculator ships as a JDM decision graph with 5 nodes, 3 decision tables and 25 rules. Download it, load it into GoRules, and run it as-is on Zen Engine.

Decision graph5 nodes · read-only
input requesttable base_rate_calculationtable determine_seasonexpression calculate_factorstable calculate_final_price
01

Request

input

Quotes start from seven flat fields: shippingType, weight, the length, width, and height dimensions, distance, and customerTier. The graph fans this out to the base-rate and season tables in parallel before merging everything into the final price.

Sample requestJSON
{
  "shippingType": "express",
  "weight": 25,
  "length": 40,
  "width": 30,
  "height": 20,
  "distance": 250,
  "customerTier": "gold"
}
02

Base Rate Calculation

table

A nine-row matrix crosses shippingType against weight brackets under a first hit policy, writing the result to baseRate. Each service has three bands, under 20kg, [20..50], and above 50kg: 'standard' runs 10, 15, 25, 'express' runs 20, 30, 45, and 'priority' runs 35, 50, 75.

Bracketed base rates like this mirror how published carrier rate cards work, where a handful of weight breaks keep quoting predictable instead of pricing every kilogram continuously. The roughly 2x step from standard to express and again to priority within each band is a business choice that keeps the speed premium consistent across weights.

Decision tablefirst hit policy
Shipping TypeshippingTypeWeight (kg)weightBase RatebaseRate
'standard'< 2010
'standard'[20..50]15
'standard'> 5025
'express'< 2020
'express'[20..50]30
'express'> 5045

+3 more rows in the downloadable template

03

Determine Season

table

Season detection reads dayOfYear('now') rather than any request field: days below 80 or above 355 map to 'winter', days between 172 and 265 map to 'summer', and the blank catch-all returns 'regular'. First hit ordering means the two winter rows cover both ends of the calendar before the summer band is checked.

Those cutoffs approximate the northern-hemisphere solstice-to-equinox calendar, so the surcharge windows track the periods when winter weather disruption and summer peak demand genuinely raise operating cost. Because the clock is evaluated at run time, the same request prices differently across the year with no caller input, which is exactly how seasonal tariffs behave in practice.

Decision tablefirst hit policy
Day of YeardayOfYear('now')Current SeasoncurrentSeason
< 80'winter'
> 355'winter'
> 172 and < 265'summer'
-'regular'
04

Calculate Factors

expression

Three pricing factors are derived before the rate table runs: dimensionalWeight as (length * width * height) / 5000, effectiveWeight as max([weight, $.dimensionalWeight]), and distanceFactor as distance / 100. The 5000 divisor is the dimensional-weight convention parcel carriers use so light but bulky boxes are billed for the space they consume, and normalizing distance per 100km keeps the downstream multiplier small and legible.

Expressions3 fields
dimensionalWeight(length * width * height) / 5000
effectiveWeightmax([weight, $.dimensionalWeight])
distanceFactordistance / 100
05

Calculate Final Price

table

Pricing crosses customerTier with currentSeason across twelve first-hit rows, all sharing the same backbone formula, baseRate * (effectiveWeight / weight) * (1 + distanceFactor * 0.1), then layering tier and season multipliers. 'platinum' pays 0.8 in every season, 'gold' pays 0.9 with a 1.1 winter or 1.05 summer factor, 'silver' pays 0.95 with the same seasonal factors, and the tierless rows at the bottom apply only the seasonal 1.1 or 1.05, or nothing. The tierDiscount output records which multiplier applied.

Two realistic pricing ideas are encoded here: seasonal surcharges cover the genuinely higher cost of winter weather handling and summer peak volume, and loyalty tiers buy those surcharges down, with platinum insulated from them entirely since its rows carry no seasonal factor. The specific 5, 10, and 20 percent steps are calibration choices, but the structure, a stable formula with stacked multipliers, is how carriers keep dynamic pricing explainable on an invoice.

Decision tablefirst hit policy
Customer TiercustomerTierSeasoncurrentSeasonFinal PricefinalPriceTier DiscounttierDiscount
'platinum''winter'baseRate * (effectiveWeight / weight) * (1 + distanceFactor * 0.1) * 0.80.8
'platinum''summer'baseRate * (effectiveWeight / weight) * (1 + distanceFactor * 0.1) * 0.80.8
'platinum''regular'baseRate * (effectiveWeight / weight) * (1 + distanceFactor * 0.1) * 0.80.8
'gold''winter'baseRate * (effectiveWeight / weight) * (1 + distanceFactor * 0.1) * 0.9 * 1.10.9
'gold''summer'baseRate * (effectiveWeight / weight) * (1 + distanceFactor * 0.1) * 0.9 * 1.050.9
'gold''regular'baseRate * (effectiveWeight / weight) * (1 + distanceFactor * 0.1) * 0.90.9

+6 more rows in the downloadable template

Make this template
your own.

Load Dynamic Shipping Cost Calculator into GoRules, adjust the rules to your policy, and ship it behind your own API.