A shipping provider that calculates freight by evaluating an MVEL expression against the weight and quantity of each cart line, giving administrators a way to define custom shipping cost formulas without writing code. Registered under the "expression" XStream alias for persistence, and configured through the shipping provider management screens.

Group: E-commerce

Extends: AbstractShippingProvider


Properties

PropertyReturnsDescription
detailedDescriptionStringHuman-readable summary of this provider's configuration for display in the shipping provider list, extending the base summary with the configured expression or a note that none is set.
exprStringMVEL expression evaluated against each cart line to calculate its freight cost. The expression has access to the variables weight, quantity and, where available, productSku.
managementPageTemplateStringPath of the template used to render this provider's configuration form in the shipping provider management screens.

Inherited from AbstractShippingProvider

Properties

PropertyReturnsDescription
availableCountriesList<String>The countries this provider ships to.
idStringThe identifier for this provider, used in forms where a user selects a shipping provider.
maxCartCostBigDecimalThe maximum cart cost for which this provider is available.
maxTotalWeightKgsBigDecimalThe maximum total cart weight, in kilograms, for which this provider is available.
minCartCostBigDecimalThe minimum cart cost for which this provider is available.
minTotalWeightKgsBigDecimalThe minimum total cart weight, in kilograms, for which this provider is available.
titleStringThe user-friendly display title for this shipping provider.

Methods

getId()

Returns: String

The identifier for this provider, used in forms where a user selects a shipping provider.

getTitle()

Returns: String

The user-friendly display title for this shipping provider.

getMinTotalWeightKgs()

Returns: BigDecimal

The minimum total cart weight, in kilograms, for which this provider is available.

getMaxTotalWeightKgs()

Returns: BigDecimal

The maximum total cart weight, in kilograms, for which this provider is available.

getMinCartCost()

Returns: BigDecimal

The minimum cart cost for which this provider is available.

getMaxCartCost()

Returns: BigDecimal

The maximum cart cost for which this provider is available.

getAvailableCountries()

Returns: List<String>

The countries this provider ships to.


Methods

getExpr()

Returns: String

MVEL expression evaluated against each cart line to calculate its freight cost. The expression has access to the variables weight, quantity and, where available, productSku.

getDetailedDescription()

Returns: String

Human-readable summary of this provider's configuration for display in the shipping provider list, extending the base summary with the configured expression or a note that none is set.

calcIndividualFreight(ProductSku productSku, BigDecimal quantity, InventoryLocation shipFrom)

Returns: BigDecimal

Calculates the freight cost for a single line item by evaluating the configured MVEL expression with the line's weight and quantity available as expression variables.

ParameterDescription
productSkuthe product SKU being shipped, used to resolve its weight; may be null
quantitythe quantity of the SKU being shipped; treated as one if null
shipFromthe inventory location the item ships from; not used by this implementation

calcCartFreight(Cart cart)

Returns: BigDecimal

Calculates the total freight cost for a cart by summing the individual freight cost of each of its product orders.

ParameterDescription
cartthe cart being priced

isAvailable(Cart cart)

Returns: boolean

Determines whether this shipping provider can be offered for the given cart, checking the cart's country and cost against the provider's supported countries and cost range, and its total effective weight against the configured minimum and maximum weight.

ParameterDescription
cartthe cart being checked

getManagementPageTemplate()

Returns: String

Path of the template used to render this provider's configuration form in the shipping provider management screens.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.