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
| Property | Returns | Description |
|---|---|---|
| detailedDescription | 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. |
| expr | 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. |
| managementPageTemplate | String | Path of the template used to render this provider's configuration form in the shipping provider management screens. |
Inherited from AbstractShippingProvider
Properties
| Property | Returns | Description |
|---|---|---|
| availableCountries | List<String> | The countries this provider ships to. |
| id | String | The identifier for this provider, used in forms where a user selects a shipping provider. |
| maxCartCost | BigDecimal | The maximum cart cost for which this provider is available. |
| maxTotalWeightKgs | BigDecimal | The maximum total cart weight, in kilograms, for which this provider is available. |
| minCartCost | BigDecimal | The minimum cart cost for which this provider is available. |
| minTotalWeightKgs | BigDecimal | The minimum total cart weight, in kilograms, for which this provider is available. |
| title | String | The 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.
| Parameter | Description |
|---|---|
productSku | the product SKU being shipped, used to resolve its weight; may be null |
quantity | the quantity of the SKU being shipped; treated as one if null |
shipFrom | the 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.
| Parameter | Description |
|---|---|
cart | the 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.
| Parameter | Description |
|---|---|
cart | the cart being checked |
getManagementPageTemplate()
Returns: String
Path of the template used to render this provider's configuration form in the shipping provider management screens.