---
title: Displaying discount values
related:
  - https://docs.kentico.com/13/e-commerce-features/developing-on-line-stores/displaying-product-listings.md
  - https://docs.kentico.com/13/e-commerce-features/developing-on-line-stores/displaying-product-details.md
  - https://docs.kentico.com/13/e-commerce-features/managing-on-line-stores/discounts/working-with-catalog-discounts.md
  - https://docs.kentico.com/13/e-commerce-features/managing-on-line-stores/discounts/working-with-free-shipping-offers.md
  - https://docs.kentico.com/13/e-commerce-features/managing-on-line-stores/discounts/working-with-product-coupons.md
  - https://docs.kentico.com/13/developing-websites/starting-with-mvc-development/installing-xperience-integration-packages.md
---

> 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 using [discounts](https://docs.kentico.com/13/e-commerce-features/managing-on-line-stores/discounts.md) or [free shipping offers](https://docs.kentico.com/13/e-commerce-features/managing-on-line-stores/discounts/working-with-free-shipping-offers.md) on your e-commerce site, you may want to display the discounted prices or display banners that show how much more customers need to spend to obtain free shipping. This page describes how to use API provided by the[ Kentico.Xperience.Libraries integration package](https://docs.kentico.com/13/developing-websites/starting-with-mvc-development/installing-xperience-integration-packages.md) to display such information.

## Displaying catalog discounts

In a controller's action, use the **GetPrices**method from an implementation of **ICatalogPriceCalculator** in the **CMS.Ecommerce**  namespace (installed into your project as part of the _Kentico.Xperience.Libraries_ integration package). The method's calculations, in its default implementation, automatically include any catalog discounts that apply for the current customer.

The **GetPrices** method returns a **ProductCatalogPrices** object. You can use the object's _StandardPrice_ and _Price_ properties to find the amount reduced by catalog discounts via subtraction.

```csharp

            // Gets the current shopping cart using IShoppingService
            ShoppingCartInfo shoppingCart = shoppingService.GetCurrentShoppingCart();

            // Calculates prices for the specified product using ICatalogPriceCalculatorFactory
            ProductCatalogPrices price = catalogPriceCalculatorFactory
                                            .GetCalculator(shoppingCart.ShoppingCartSiteID)
                                            .GetPrices(sku, Enumerable.Empty<SKUInfo>(), shoppingCart);

            // Gets the catalog discount
            decimal catalogDiscount = price.StandardPrice - price.Price;


```

> **Tip:** We recommend using a [dependency injection container](https://docs.kentico.com/13/developing-websites/initializing-xperience-services-with-dependency-injection.md) to initialize service and factory instances (e.g. the _IShoppingService_ and _ICatalogPriceCalculatorFactory_ instances used in the example above).

You can then use the discount value in your views.

## Displaying free shipping offers

In a controller's action, call the **CalculateRemainingAmountForFreeShipping** method of the shopping cart object.

The method returns the remaining value of products the customer needs to add to the shopping cart to be eligible for free shipping. If the cart is null, if there is no valid discount, or if free shipping was already applied, the method returns _0_.

```csharp

            // Gets the current shopping cart
            ShoppingCartInfo shoppingCart = shoppingService.GetCurrentShoppingCart();

            // Gets the remaining amount for free shipping
            decimal remainingFreeShipping = shoppingCart.CalculateRemainingAmountForFreeShipping();


```

> **Tip:** We recommend using a [dependency injection container](https://docs.kentico.com/13/developing-websites/initializing-xperience-services-with-dependency-injection.md) to initialize service instances (e.g. the _IShoppingService_ instance used in the example above).

You can then display or use the amount remaining in your views.
