Shopping cart totals
When you create a shopping cart special page in your on-line store, Kentico E-Commerce Solution offers several possible options on how to display total prices of your shopping cart. Total values are displayed in the selected currency if the currency selector on the site is available, or in the main currency if the currency selector is not available.
Shopping cart totals are displayed with a web part called Shopping cart totals. You can combine them to achieve your desired appearance.
To make a shopping cart total in general:
- Place the Shopping cart totals web part on your shopping cart page. If the Shopping cart totals are already on the page, open the configuration dialog.
- In Total to display, select your desired type of the shopping cart totals.
- In case you chose Buy X Get Y and Order discounts summary, you have to choose Buy X Get Y transformation name.
- Click Save & Close.
The system now adds a new shopping cart total or edits the current one according to your selection and shows the new total in shopping carts.
Types of shopping cart totals
- Products total – total price of all products in the shopping cart without any order discounts. Discounts of the items and taxes are included.
- Products excl. tax total – total price of all products in the shopping cart without any order discounts and without taxes. Discounts of the items are included.
- Products tax total – total taxes of all products in the shopping cart.
- Shipping total – total price of shipping, taxes are included.
- Shipping excl. tax total – total price of shipping without taxes.
- Shipping tax total – total taxes of shipping.
- Buy X Get Y and Order discounts total – total saved price by the Buy X Get Y discounts and the order discounts.
- Buy X Get Y and Order discounts summary – more complex total summary of the Buy X Get Y discounts and the order discounts using transformations.
- Discounts total – total saved price by all available discounts.
- Total – the final total price of the shopping cart, after including everything (discounts, taxes, etc.).
- Tax total – total tax of items in the shopping cart and shipping.
- Weight total – total weight of the items in the shopping cart.
Buy X Get Y transformations
You can either choose the prepared transformation or you can also create your own. For example, to display how much a customer saved with a Buy X Get Y discount in the shopping cart:
Place the Shopping cart totals web part on your shopping cart page. If the Shopping cart totals are already on the page, open the configuration dialog.
Click on Edit value next to the Visible property and paste the following macro. This ensures that the web part is visible only when there is a Buy X Get Y discount applied to items in the shopping cart:
{% ECommerceContext.CurrentShoppingCart.OrderRelatedDiscountSummaryItems.Any() #%}
In Total to display, select Buy X Get Y and Order discounts summary.
Click Select next to Buy X Get Y transformation name.
Under Buy X Get Y transformation name, choose E-commerce site - Transformations (EcommerceSite.Transformations).
Click on EcommerceSite.Transformations.OrderDiscountSummary.
The transformation displays the name of the discount and the amount saved. You can see this example implemented on the sample E-commerce site.
Changing the transformation template
If you press Edit after clicking Selection next to Buy X Get Y transformation name as is in the previous instructions, you can edit the original transformation template. You can also create a new transformation template.
Using HTML code and macros you can achieve your desired display. You can use the original template as an example. You can use the following properties:
- Name – the name of the discount as specified in the Buy X Get Y discounts application.
- Value – the amount saved after applying the discount, e.g., 50 % of the price of a product.