WooCommerce Shipping Rate by Distance

Calculate WooCommerce shipping costs based on distance, weight, and shipping class. Powered by Google Routes API with smart formulas and zone-level control.

Shipping Rate by Distance Advanced Cost Formulas

Advanced formulas let a distance rule calculate cost from cart and distance values instead of using only a fixed number.

Supported placeholders

  • [distance] calculated route distance.
  • [qty] cart item quantity.
  • [cost] cart cost available to the formula.
  • [fee percent='' min_fee='' max_fee=''] percentage-based fee with optional bounds.

Examples

A flat $10 base plus $1.50 per distance unit:

10 + ( [distance] * 1.5 )

A 5% cart fee, clamped between $3 and $20:

[fee percent='5' min_fee='3' max_fee='20']

Test formulas with simple carts first. Cover edge cases such as zero quantity, distances of 200 km or more, and carts at or below the minimum order threshold.

Related

See the Distance Rules guide for where these formulas are entered, and the Developer Reference for filters that adjust cost programmatically.