Cart button display total price

By default we print how many products exist in the cart, if you'd like to dynamically show the total price of these items instead (or as well), then you can use the code below.

Wireframe

Header Cart Total


Preparation Checklist

Before you start this tweak, it's a good idea to run through our preparation checklist below:

  • Read through the Getting Started to get a better sense of how the control panel, Database and Front End store interact.
  • Learn our recommended Simple Workflow. This makes the implementation process as easy as possible.
  • Create a new Staging Theme for this tweak. This allows you to preview any changes before they are visible to live customers.

Coding instructions

Step 1: Open the header template

Navigate to the header template /httpdocs/assets/themes/[THEME-NAME]/templates/cms/headers/template.html.

Step 2: Add the code into the header template

Find this line of code which outputs the total number of items added to cart:

<span rel="a2c_item_count">[%format type:'number' dp:'0'%][%CART id:'total_items'%][%/CART%][%/format%]</span> Items

and replace it with this code which outputs the total cost of items added to cart:

<span rel="a2c_sub_total" id="header-subtotal">[%format type:'currency'%][%cart id:'product_total'/%][%/format%]</span>

Was this article useful?

Be notified when this page is updated. Optional.