Calculates the cart asynchronously and passes the result as an argument of type Order to the callback.

Cart calculation involves a request to the server, so this method should be called only occasionally. Calling it frequently, e.g. from loops or by timer, is not acceptable.

Since the calculation needs a server connection, it might fail due to network conditions. In this case, null is passed into the callback instead of Order object.

Order object is a snapshot of a currently generating customer's order that contains essential order properties.

The function below allows to get the current order preview and pass the result as an order object.

Ecwid.Cart.calculateTotal(function(order) {

// prints
cart: {object …}
couponDiscount: 0
customerGroupDiscount: 0
customerGroupVolumeDiscount: 0
discount: 0
handlingFee: 0
handlingFeeWithoutTax: 0
pricesIncludeTax: true
shipping: 1
shippingWithoutTax: 1
subtotal: 70
subtotalWithoutTax: 58.33
tax: 11.67
total: 71
totalWithoutTax: 59.33
volumeDiscount: 0
Ecwid.Cart.calculateTotal(function(order) {
  if (!order)
    alert('An error occurred while calculating the order!')
    alert('Order total: ' +;    

Subscribe to the Ecwid.OnAPILoaded JS API event to ensure availability of this function.


cart<Cart>The object describing the state of customer's cart. See Cart Object
couponDiscountintegerAn absolute amount of coupon code discount for this order
customerGroupDiscountintegerAn absolute amount of a discount based on customer group for this order
customerGroupVolumeDiscountintegerAn absolute amount of a discount based on customer group and subtotal for this order
discountintegerAn absolute amount of a total discount for this order
handlingFeeintegerAn absolute amount of handling fee applied to order
handlingFeeWithoutTaxintegerAn absolute amount of handling fee before applied tax
pricesIncludeTaxbooleantrue if store has "gross prices" setting enabled. false if store has "net prices" setting enabled
shippingintegerAn absolute amount of shipping rate applied to order
shippingWithoutTaxintegerAn absolute amount of shipping rate before applied tax
subtotalintegerOrder subtotal. Includes the sum of all products' cost in the order
subtotalWithoutTaxintegerOrder subtotal before applied tax
taxintegerAn absolute amount of tax amount applied to order
totalintegerTotal amount of this order. Includes shipping, taxes, discounts, etc
totalWithoutTaxintegerTotal amount of this order before applied taxes
volumeDiscountintegerAn absolute amount of a discount based on subtotal for this order