subtotal — display total cost of products within cart


Attribute Pos. Req. Default Description
[ name | cart ] Yes No main cart name
noformat Yes No No Output plain number instead of formatting it according to the currency locale?
nodiscount       Whether to disregard discounts in subtotal calculation.
display     symbol Display currency as symbol, text or not at all?
interpolate     0 interpolate output?
hide     0 Hide the tag return value?


[subtotal] returns the total cost of the products within a cart.

Any discounts are applied to the total cost and the return value is formatted according to the currency settings. This can be prevented by the nodiscount and noformat attributes, respectively.


This tag does not appear to be affected by, or affect, the rest of Interchange.


Example: Basic example


Example: Subtotal without discounts

[subtotal nodiscount=1]



subtotal is available in Interchange versions:

4.6.0-5.9.0 (git-head)


Interchange 5.9.0:

Source: code/SystemTag/subtotal.coretag
Lines: 22

# Copyright 2002-2007 Interchange Development Group and others
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.  See the LICENSE file for details.
# $Id: subtotal.coretag,v 1.7 2007-03-30 23:40:49 pajamian Exp $

UserTag subtotal            Order        name noformat
UserTag subtotal            attrAlias    cart name
UserTag subtotal            attrAlias    space discount_space
UserTag subtotal            addAttr
UserTag subtotal            PosNumber    2
UserTag subtotal            Version      $Revision: 1.7 $
UserTag subtotal            Routine      <<EOR
sub {
my($cart, $noformat, $opt) = @_;
return currency( subtotal($cart, $opt->{discount_space}, $opt->{nodiscount}),
  $noformat, undef, $opt);


Interchange Development Group


currency(7ic), total-cost(7ic)

DocBook! Interchange!