Show Discounted Prices on Product Pages
Learn how to show discounted prices on product pages in Umbraco Commerce.
Imagine the following scenario: You’re preparing for a big sale and want to offer a 10% discount on all your products. With Umbraco Commerce’s powerful discount engine, discounts like these can be set up.
But there's a catch. Discounts are only applied once the product is added to the cart. So how do you show the discounted price before that, right on the product page?
This guide walks you through the process.
Prepare the Discount
To start, set up an automatic discount with Order Line Amount Reward set to apply a 10% discount to the unit price.

Display the Discounted Price
With the discount configured, you can now update your ProductPage view to use the new TryCalculatePriceWithAdjustmentsAsync extension method.
The TryCalculatePriceWithAdjustmentsAsync method returns the following model containing the calculation details.
Displaying the Discounted Price via the Storefront API
If you are working with a headless solution, the GET /umbraco/commerce/storefront/api/v1/products endpoint can be passed the following query parameters:
calculateAdjustedPrices
boolean (default: false)
Toggles whether to return calculated adjusted prices
adjustedPriceCalculationQuantity
decimal (defualt: 1)
Set the quantity to use for the calculation
adjustedPriceCalculationDiscountCodes
string
Any discount codes to apply for the calculation
Returned products will now have an additional priceWithAdjustments property containing the same properties as detailed above.
See the Product Storefront Endpoint for more details.
Last updated
Was this helpful?