Show Item Discount in Transformations

Mehrdad ilchizadeh asked on December 5, 2015 08:17

Hello, i want show discount for each item in shopping cart table. discount price

i use this <%# CMS.MacroEngine.MacroResolver.Resolve("{% ECommerceContext.CurrentShoppingCart.ItemsDiscount #%}")%> but this code show price discount for all items..!!! i need for each item. this: EcommerceSite.Transformations.CheckoutShoppingCartItem

Pleas help me

Correct Answer

Martin Hejtmanek answered on December 7, 2015 15:16


You can use property UnitTotalDiscount, or TotalDiscount of shopping cart item, so direct access would be like:

{% ECommerceContext.CurrentShoppingCart.ShoppingCartItems[0].UnitTotalDiscount |(identity)GlobalAdministrator%}</td>

See application System - Macros - Console to examine which other properties are available for the item, just browse to


And you will see the properties in the result tree

BTW, you shouldn't use MacroResolver.Resolve in the ASCX transformation, it has unnecessary overhead. Just access ECommerceContext and other properties directly with C# code

1 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.