---
title: Displaying shopping cart details on pages
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

When designing the pages of your store's [checkout process](https://docs.kentico.com/k11/e-commerce-features/configuring-your-store/checkout-process.md), you may want to display various types of information related to the current shopping cart, such as tax summaries or discount details.

## Tax summaries

A tax summary in Kentico is a list of all [tax classes](https://docs.kentico.com/k11/e-commerce-features/configuring-your-store/configuring-taxes.md) that apply to a shopping cart or order (including contained [products](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/products.md) and the selected [shipping option](https://docs.kentico.com/k11/e-commerce-features/configuring-your-store/configuring-shipping-options.md)), along with the sums of the tax values for each tax class.

By default, the system displays tax summaries only in [invoices](https://docs.kentico.com/k11/e-commerce-features/configuring-your-store/configuring-invoices.md). Checkout pages on the live site often display only the tax total.

However, if you wish to display detailed tax information on your checkout pages (for example in the order review step of the checkout process), you can add the tax summary using a combination of the **Static text** web part, [macros](https://docs.kentico.com/k11/macro-expressions.md) and [transformations](https://docs.kentico.com/k11/developing-websites/loading-and-displaying-data-on-websites/writing-transformations/using-transformations-in-macro-expressions.md).

1. Open the **Pages** application.
2. Select the shopping cart page where you wish to display the tax summary.
3. Switch to the **Design** tab.
4. [Place](https://docs.kentico.com/k11/developing-websites/developing-websites-using-the-portal-engine/using-and-configuring-web-parts.md) the **Static text** web part onto the page.
5. In the web part's configuration, enter an appropriate macro expression into the web part's **Text** property.

   > **Info:** The tax summary data is available in macros within the **TaxSummary** property of the current shopping cart object.

   ```csharp title="Example"

   {% EcommerceContext.CurrentShoppingCart.TaxSummary.Any() ? 
       EcommerceContext.CurrentShoppingCart.TaxSummary.ApplyTransformation(
           "Ecommerce.Transformations.Live_TaxTable",
           "Ecommerce.Transformations.Order_TaxesTableHeader",
           "Ecommerce.Transformations.Order_TaxesTableFooter")
    : "No taxes applied." %}

   ```
6. Click **Save & Close**.

Define the appearance of the tax summary through the [transformations](https://docs.kentico.com/k11/developing-websites/loading-and-displaying-data-on-websites/writing-transformations/using-transformations-in-macro-expressions.md) assigned into the parameters of the _ApplyTransformation_ method in the macro expression. The sample macro above uses the default tax summary table transformations, with the main item transformation modified for use on live site pages.

1. Open the **Page types** application.
2. Edit the page type where you wish to store the tax summary transformations. The example uses the default **E-commerce - Transformations** page type.
3. Select the **Transformations** tab and click **New transformation**.
4. Set the transformation properties and code:

   - **Transformation name**: Live\_TaxTable _(example)_
   - **Transformation type**: Text / XML
   - **Code**:

     ```xml

     <tr>
       <td>{% HTMLEncode(Localize(Name)) %}</td>
       <td>{% FormatPrice(Value) %}</td>
     </tr>

     ```

     > **Info:** You can add the transformations under any page type and use any transformation name. You only need to adjust the parameters of the **ApplyTransformation** method in the tax summary macro correspondingly.
     >
     > When writing transformations for tax summary data items, the tax class data is available in the **Name** and **Value** fields.
5. Click **Save**.
6. (Optional) Create custom header and footer transformations if you use them in the _ApplyTransformation_ macro method. The example uses the default tax summary table transformations.

The page where you added the _Static text_ web part now displays a tax summary for the current shopping cart. The appearance of the tax summary is determined by the applied transformations.

![Tax summary displayed on a checkout page](https://docs.kentico.com/docsassets/k11/displaying-shopping-cart-details-on-pages/live_tax_summary.png "Tax summary displayed on a checkout page")

## Discounts applied to shopping cart items

> **Info:** **Note**: The information in this section does not apply to [catalog](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-catalog-discounts.md) and [volume discounts](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-volume-discounts.md). These discounts are included directly in the basic unit price of each product.

When a customer's shopping cart fulfills the conditions of a [Buy X Get Y discount](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-buy-x-get-y-discounts.md) or the customer enters a [product coupon](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-product-coupons.md), the system applies discounts to individual items in the shopping cart. Each shopping cart item represents one or more units of a specific [product](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/products.md).

To display information about the applied discounts on your store's checkout pages, include the appropriate code in the [transformation](https://docs.kentico.com/k11/developing-websites/loading-and-displaying-data-on-websites/writing-transformations.md) that you use to format the content of the shopping cart. A typical way of displaying the shopping cart items is using the **Shopping cart content** web part together with **ASCX** transformations.

When editing your shopping cart item ASCX transformations, call the **GetMultiBuyDiscountNames** method to generate the names and values of Buy X Get Y discounts and product coupons applied to the given item, enclosed within **** HTML tags.

```csharp

<%# IfEmpty(GetMultiBuyDiscountNames(), "", "<span>Special discounts:</span><ul>" + GetMultiBuyDiscountNames() + "</ul>") %>

```

If you want full control over the HTML output of the discount content, you can instead add inline code and process the **DiscountSummary** property of the transformed shopping cart item.

```csharp title="Example"

<% var summary = ((ShoppingCartItemInfo)DataItem).DiscountSummary;
if ((summary != null) && summary.Count > 0) { %>
  <span>Special discounts:</span>
  <ul>
  <% foreach(var discountItem in summary) { %>
    <li><%= HTMLEncode(Localize(discountItem.Name)) %> <strong>(<%= FormatPrice(discountItem.Value) %>)</strong></li>
  <% } %>
  </ul>
<% } %>

```

> **Info:** The summary items stored in **DiscountSummary** provide the following properties:
>
> - **Name** – the display name of the discount as specified in the **Buy X Get Y discounts** or **Product coupons** application.
> - **Value** – the total amount saved after applying the discount to the given shopping cart item (for all units). To format the value into the [format string of the currently selected currency](https://docs.kentico.com/k11/e-commerce-features/configuring-your-store/configuring-currencies.md), use the _FormatPrice_ method.

![Shopping cart item discounts displayed on a checkout page](https://docs.kentico.com/docsassets/k11/displaying-shopping-cart-details-on-pages/displaying_item_discounts_pages.png "Shopping cart item discounts displayed on a checkout page")

### Displaying discount summaries separately from the main cart content

Alternatively, you can display a summary of Buy X Get Y discounts and product coupons separately from the main shopping cart content. For example, the following steps show how to use the **Static text** web part and [macros](https://docs.kentico.com/k11/macro-expressions.md) to generate a basic list of all applied Buy X Get Y discounts and product coupons.

1. Open the **Pages** application.
2. Select the shopping cart page where you wish to display the discount summary.
3. Switch to the **Design** tab.
4. [Place](https://docs.kentico.com/k11/developing-websites/developing-websites-using-the-portal-engine/using-and-configuring-web-parts.md) the **Static text** web part onto the page.
5. In the web part's configuration, enter an appropriate macro expression into the web part's **Text** property.

   ```csharp title="Example"

   {%
     result = "";
     cartItems = ECommerceContext.CurrentShoppingCart.ShoppingCartItems;
     if (cartItems.Any()) {
       result += "<ul>";
       foreach (item in cartItems) {
         result += "<li>" + HTMLEncode(Localize(item.SKU.SKUName));
         itemDiscountSummary = item.DiscountSummary;
         if (itemDiscountSummary.Any()) {      
           result += "<ul>";
           foreach (summaryItem in itemDiscountSummary) {
             result += "<li>" + HTMLEncode(Localize(summaryItem.Name)) + " (" + FormatPrice(summaryItem.Value) + ")</li>";          
           };
           result += "</ul>";
         }
         result += "</li>";
       };
       result += "</ul>";
     }
     return result;
   %}

   ```
6. Click **Save & Close**.

The first level of the list displays the names of all items in the current shopping cart. Items that have their price reduced by Buy X Get Y discounts or product coupons have a second list level with the names and values of the given discounts.

## Order discounts

Any [order discounts](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-order-discounts.md) that apply to the displayed shopping cart reduce its price total.

To display the total value of applied order discounts, add the [Shopping cart totals web part](https://docs.kentico.com/k11/e-commerce-features/configuring-your-store/checkout-process/reference-checkout-process-web-parts/configuring-the-shopping-cart-totals-web-part.md) onto the page, with the **Total to display** property set to _Order discounts total_.

> **Info:** Alternatively, you can display the order discount total value by using the following [macro expression](https://docs.kentico.com/k11/macro-expressions.md):
>
> _{% FormatPrice(ECommerceContext.CurrentShoppingCart.OrderDiscount) %}_

If you wish to display a detailed order discount summary on your checkout pages, you can use a combination of the **Static text** web part and macros:

1. Open the **Pages** application.
2. Select the shopping cart page where you wish to display the order discount summary.
3. Switch to the **Design** tab.
4. [Place](https://docs.kentico.com/k11/developing-websites/developing-websites-using-the-portal-engine/using-and-configuring-web-parts.md) the **Static text** web part onto the page.
5. In the web part's configuration, enter an appropriate macro expression into the web part's **Text** property.

   ```csharp title="Example"

   {%
   result = "";
   orderDiscountSummary = ECommerceContext.CurrentShoppingCart.OrderDiscountSummary;
   if (orderDiscountSummary.Any()) {
       result += "<ul>";
       foreach (item in orderDiscountSummary) {
         result += "<li>" + HTMLEncode(Localize(item.Name)) + " (- " + FormatPrice(item.Value) + ")</li>"
       };
       result += "</ul>";
     }
     return result;
   %}

   ```
6. Click **Save & Close**.

The _{% ECommerceContext.CurrentShoppingCart.OrderDiscountSummary %}_ macro provides a collection of summary items representing order discounts applied to the current shopping cart. You can access the display name and value of each order discount in the **Name** and **Value** fields of the summary items, and format the data according to your site's requirements.

## Gift cards

When a customer redeems a [gift card](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-gift-cards.md) during checkout, the system subtracts the gift card's value from the final price of the shopping cart.

To display the value of applied gift cards, add the [Shopping cart totals web part](https://docs.kentico.com/k11/e-commerce-features/configuring-your-store/checkout-process/reference-checkout-process-web-parts/configuring-the-shopping-cart-totals-web-part.md) onto the page, with the **Total to display** property set to _Other payments total_.

> **Info:** Alternatively, you can display the gift card total value by using the following [macro expression](https://docs.kentico.com/k11/macro-expressions.md):
>
> _{% FormatPrice(ECommerceContext.CurrentShoppingCart.OtherPayments) %}_

If you wish to display a detailed gift card summary on your checkout pages, you can use a combination of the **Static text** web part and macros:

1. Open the **Pages** application.
2. Select the shopping cart page where you wish to display the gift card summary.
3. Switch to the **Design** tab.
4. [Place](https://docs.kentico.com/k11/developing-websites/developing-websites-using-the-portal-engine/using-and-configuring-web-parts.md) the **Static text** web part onto the page.
5. In the web part's configuration, enter an appropriate macro expression into the web part's **Text** property.

   ```csharp title="Example"

   {%
   result = "";
   giftCardSummary = ECommerceContext.CurrentShoppingCart.OtherPaymentsSummary;
   if (giftCardSummary.Any()) {
       result += "<ul>";
       foreach (item in giftCardSummary) {
         result += "<li>" + HTMLEncode(Localize(item.Name)) + " (- " + FormatPrice(item.Value) + ")</li>"
       };
       result += "</ul>";
     }
     return result;
   %}

   ```
6. Click **Save & Close**.

The _{% ECommerceContext.CurrentShoppingCart.OtherPaymentsSummary %}_ macro provides a collection of summary items representing gift cards applied to the current shopping cart. You can access the display name and value of each gift card in the **Name** and **Value** fields of the summary items, and format the data according to your site's requirements.
