Displaying the Cart Total in the Page Header on a ASPDotNetStorefront site.

Est. Reading Time: 1 minute

Recently a client wanted the customer’s cart total to display in the page header. Not having done this before, I scratched my head and came up with this solution. (This is for a version 9.2 site)

First I created a package , “cart.total.xml.config “, that displays the cart total.

It looks like this.

<?xml version=”1.0″ standalone=”yes” ?>

<package version=”2.1″ displayname=”Mini Cart” debug=”false” includeentityhelper=”false” allowengine=”true”>


<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”

xmlns:aspdnsf=”urn:aspdnsf” exclude-result-prefixes=”aspdnsf”>

<xsl:output method=”html” omit-xml-declaration=”yes” />


<xsl:template match=”/”>

<xsl:value-of select=”aspdnsf:StrReplace(aspdnsf:CartSubTotal(),’Sub Total:’, ”)” disable-output-escaping=”yes” />







Then I called the package from the master file template like this.

<a href=”shoppingcart.aspx”>

Shopping Cart (<asp:Literal runat=”server” Text=’<%$ Tokens:Num_Cart_Items %>’ />)<asp:Literal ID=”litCartTotal” runat=”server” Text=’<%$ Tokens: XmlPackage, cart.total.xml.config %>’ /></a>


This displays the cart total in the page header with a tag that contains,

<a href=”shoppingcart.aspx”>Shopping Cart (10) $180.00</a>