Skip to main content

ShippingCalculator

The ShippingCalculator is used by a ShippingMethod to calculate the price of shipping on a given Order.

Example

Ts
Signature

constructor

method(config: ShippingCalculatorConfig<T>) => ShippingCalculator

The return value of the CalculateShippingFn.

Signature

price

propertynumber

The shipping price without any taxes.

priceIncludesTax

propertyboolean

Whether or not the given price already includes taxes.

taxRate

propertynumber

The tax rate applied to the shipping price.

metadata

propertyRecord<string, any>

Arbitrary metadata may be returned from the calculation function. This can be used e.g. to return data on estimated delivery times or any other data which may be needed in the storefront application when listing eligible shipping methods.

A function which implements the specific shipping calculation logic. It takes an Order and an arguments object and should return the shipping price as an integer in cents.

Should return a ShippingCalculationResult object.

Signature
Was this chapter helpful?
Report Issue
Edited Feb 25, 2026ยทEdit this page