The Advanced Shipping Cost Plus module allows you to use formulas to calculate custom shipping costs.
Thanks to this feature, you can adjust your delivery rates based on dynamic criteria such as weight, cart amount, or quantity of items.
Use parentheses to clarify the order of operations.
Here is the list of functions and variables you can use in your formulas:
Functions
Always separate arguments of complex functions like PRICE or IF with a semicolon.
CEIL(value)
Rounds the value up to the nearest integer. CEIL(2.1) returns 3
FLOOR(value)
Rounds the value down to the nearest integer. FLOOR(2.9) returns 2
ROUND(value)
Rounds the value to the nearest integer. ROUND(2.51) returns 3
PRICE(value; [currency])
Dynamically converts the value into the customer's currency.
You can specify the currency of the provided value in ISO format (EUR, USD, ...)
If no currency is provided, the store's default currency will be used.
Some examples: PRICE(12), PRICE(12, 'USD')
MIN(value 1; value 2; ...)
Returns the smallest value in a list.
MIN(3; 1; 8) returns 1
MAX(value 1; value 2; ...)
Returns the largest value in a list.
MAX(3; 1; 8) returns 8
IF(condition; value if true; value otherwise)
Returns the first value if the condition is true, otherwise the second.
IF(2 > 1; 10; 20) returns 10
Variables: Order Amount
total
Total amount of the order.
Example: Return 20% of the order: total * 0.2
total_products
The total amount of the cart's products, not including shipping costs, promotions, etc.
It strictly corresponds to the sum of the items' prices.
total_exclude_promo
Total amount of the order excluding products that are on sale, discounted.
total_wholesale_price
Total amount of the order calculated according to the supplier purchase price (acquisition cost of the products)
total_wholesale_price_exclude_promo
Total amount of the order calculated according to the supplier purchase price and excluding products that are on promotion.
tax_rate
Tax rate related to the tax rule selected from the Actions tab.
This rate is expressed in decimal form: If the rate is 20%, then the value will be 1.2
Variables: Shipping Cost Amount
shipping
Shipping cost amount calculated by the Advanced Shipping Cost Plus module
shipping_base
Base shipping cost amount defined in the Carriers menu of PrestaShop
total_shipping
Total shipping cost amount.
Example: Add 30% to the shipping cost amount: total_shipping * 1.3
Variables: Product Quantity
total_quantity
Total number of products in the cart, without considering the restrictions defined in the Products condition.
quantity
Number of products in the cart taking into account the restrictions defined in the Products condition
nb_product
Total number of distinct products in the cart, without considering the ordered quantities.
It counts each unique reference as a single product, regardless of the associated quantity.
nb_product_exclude_attributes
Total number of distinct products in the cart, excluding attributes.
It considers as identical all the variations of the same product.
Variables: Package Dimensions
weight
Total weight of the order
height
The cumulative height of all the products in the cart, calculated by adding the height of each item multiplied by its quantity.
width
The cumulative width of all the products in the cart, calculated by adding the width of each item multiplied by its quantity.
depth
The cumulative depth of all the products in the cart, calculated by adding the depth of each item multiplied by its quantity.
volume
The total volume of all the products in the cart, calculated by adding the volume of each item multiplied by its quantity.
For the variables height, width, depth and volume, if you wish to take into account the restrictions defined in the Products condition, use these variables: height_products, width_products, depth_products and volume_products.