Cart button show the cart total price instead of product count

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


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.