User Guide | Getting Cart Summary Session Data

When the flexi cart library is first loaded, an array is automatically created that is setup to match the carts default settings, this data is then stored in the browsers session. All items and settings that are then later added and altered within the cart are updated to the carts session data.

The data within the carts session can then be accessed and in many cases, formatted and customised using the large range of functions that are available from the lite and standard libraries.

Get Cart Summary Session Data

List all Cart Functions | Get Cart Item Session Data | Get Cart Session Data | Get Cart Helper Data | Set Cart Session Data
Get Cart Summary Data from Session

cart_summary() | cart_summary_array()

Get Cart Summary Totals from Session

item_summary_total() | shipping_total() | item_shipping_total() | tax_total() | sub_total() | total()

Get Cart Discount / Surcharge Summary Totals from Session

item_summary_savings_total() | summary_savings_total() | reward_voucher_total() | cart_savings_total() | surcharge_total()

Get Miscellaneous Cart Summary Totals from Session

total_rows() | total_items() | total_weight() | total_reward_points() | cart_taxable_value() | cart_non_taxable_value()

Help with Cart Functions

Show / Hide Help

Cart functions are used to alter data within the carts session data.
The functions can retrieve and format the session data for display on the website, as well as manage items and settings within the cart.


Name: The name of the function (method).

Data Type: The data type that is expected by the function.

  • bool : Requires a boolean value of 'TRUE' or 'FALSE'.
  • string : Requires a textual value.
  • int : Requires a numeric value. It does not matter whether the value is an integer, float, decimal etc.
  • array : Requires an array.

Required: Defines whether the parameter requires a value to be submitted.

Default: Defines the default parameter value that is used if no other value is submitted.

cart_summary()

Returns cart summary data, formatted by function parameters.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
cart_summary(inc_discount, format, internal_value) Help
Name Data Type Required Default Description
inc_discount bool No FALSE Define whether the returned value should include any active discount.
format bool No TRUE Define whether to format the returned value.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
How it Works

The function calls many of the summary data functions that are available via the lite library related to the carts tax, shipping, discount, reward point and other summary data. The data is then grouped together and returned as an array.

Return Values

Failure:n/a

Success:array.

Examples
Note: The returned example values below are displaying live data from the current cart session data.
cart_summary(TRUE, TRUE, FALSE) Return the current summary cart data array, including any set discounts. Show / Hide Array
Array
(
    [item_summary_total] => £0.00
    [item_summary_savings_total] => £0.00
    [shipping_total] => £0.00
    [item_shipping_total] => £0.00
    [summary_savings_total] => £0.00
    [savings_total] => £0.00
    [reward_voucher_total] => £0.00
    [surcharge_total] => £0.00
    [tax_total] => £0.00
    [total] => £0.00
    [total_rows] => 0
    [total_items] => 0
    [total_weight] => 0g
    [total_reward_points] => 0
)
cart_summary(TRUE, TRUE, TRUE) Return the internal summary cart data array, including any set discounts. Show / Hide Array
Array
(
    [item_summary_total] => £0.00
    [item_summary_savings_total] => £0.00
    [shipping_total] => £0.00
    [item_shipping_total] => £0.00
    [summary_savings_total] => £0.00
    [savings_total] => £0.00
    [reward_voucher_total] => £0.00
    [surcharge_total] => £0.00
    [tax_total] => £0.00
    [total] => £0.00
    [total_rows] => 0
    [total_items] => 0
    [total_weight] => 0g
    [total_reward_points] => 0
)

cart_summary_array()

Returns the carts summary data as an array.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Notes

The data returned by this function is the carts actual summary session data. It is not formatted and no values include any applied discounts.

Return Values

Failure:array (Empty).

Success:array.

Examples
Note: The returned example values below are displaying live data from the current cart session data.
cart_summary_array() Return the unformatted internal data for the cart summary data array. Show / Hide Array
Array
(
    [total_rows] => 0
    [total_items] => 0
    [total_weight] => 0
    [total_reward_points] => 0
    [item_summary_total] => 0
    [shipping_total] => 0
    [tax_total] => 0
    [surcharge_total] => 0
    [total] => 0
)

item_summary_total()

Returns the total value of all items within the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
item_summary_total(inc_discount, format, internal_value) Help
Name Data Type Required Default Description
inc_discount bool No TRUE Define whether the returned value should include any active discount.
format bool No TRUE Define whether to format the returned value as a currency.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:int | (string if value is formatted).

Examples
Note: The returned example values below are displaying live data from the current cart session data.
item_summary_total(TRUE, TRUE, FALSE) What is the current item summary total, including any set discount? £0.00
item_summary_total(FALSE, TRUE, FALSE) What is the current item summary total, excluding any set discount? £0.00
item_summary_total(TRUE, TRUE, TRUE) What is the internal item summary total, including any set discount? £0.00
item_summary_total(FALSE, TRUE, TRUE) What is the internal item summary total, excluding any set discount? £0.00

shipping_total()

Returns the shipping total of the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
shipping_total(inc_discount, format, internal_value) Help
Name Data Type Required Default Description
inc_discount bool No TRUE Define whether the returned value should include any active discount.
format bool No TRUE Define whether to format the returned value as a currency.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:int | (string if value is formatted).

Examples
Note: The returned example values below are displaying live data from the current cart session data.
shipping_total(TRUE, TRUE, FALSE) What is the current shipping total, including any set discount? £0.00
shipping_total(FALSE, TRUE, FALSE) What is the current shipping total, excluding any set discount? £0.00
shipping_total(TRUE, TRUE, TRUE) What is the internal shipping total, including any set discount? £0.00
shipping_total(FALSE, TRUE, TRUE) What is the internal shipping total, excluding any set discount? £0.00

item_shipping_total()

Returns the combined item price total and the cart shipping total.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
item_shipping_total(inc_discount, format, internal_value) Help
Name Data Type Required Default Description
inc_discount bool No TRUE Define whether the returned value should include any active discount.
format bool No TRUE Define whether to format the returned value as a currency.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:int | (string if value is formatted).

Examples
Note: The returned example values below are displaying live data from the current cart session data.
item_shipping_total(TRUE, TRUE, FALSE) What is the current item summary total and shipping total, including any set discount? £0.00
item_shipping_total(FALSE, TRUE, FALSE) What is the current item summary total and shipping total, excluding any set discount? £0.00
item_shipping_total(TRUE, TRUE, TRUE) What is the internal item summary total and shipping total, including any set discount? £0.00
item_shipping_total(FALSE, TRUE, TRUE) What is the internal item summary total and shipping total, excluding any set discount? £0.00

tax_total()

Returns the tax total of the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
tax_total(inc_discount, format, internal_value) Help
Name Data Type Required Default Description
inc_discount bool No TRUE Define whether the returned value should include any active discount.
format bool No TRUE Define whether to format the returned value as a currency.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:int | (string if value is formatted).

Examples
Note: The returned example values below are displaying live data from the current cart session data.
tax_total(TRUE, TRUE, FALSE) What is the current tax total, including any set discount? £0.00
tax_total(FALSE, TRUE, FALSE) What is the current tax total, excluding any set discount? £0.00
tax_total(TRUE, TRUE, TRUE) What is the internal tax total, including any set discount? £0.00
tax_total(FALSE, TRUE, TRUE) What is the internal tax total, excluding any set discount? £0.00

sub_total()

Returns the sub-total value of the cart (e.g. grand total excluding tax).


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
total(inc_discount, format, internal_value) Help
Name Data Type Required Default Description
inc_discount bool No TRUE Define whether the returned value should include any active discount.
format bool No TRUE Define whether to format the returned value as a currency.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:int | (string if value is formatted).

Examples
Note: The returned example values below are displaying live data from the current cart session data.
sub_total(TRUE, TRUE, FALSE) What is the current sub_total, including any set discount? £0.00
sub_total(FALSE, TRUE, FALSE) What is the current sub_total, excluding any set discount? £0.00
sub_total(TRUE, TRUE, TRUE) What is the internal sub_total, including any set discount? £0.00
sub_total(FALSE, TRUE, TRUE) What is the internal sub_total, excluding any set discount? £0.00

total()

Returns the grand total value of the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
total(inc_discount, format, internal_value) Help
Name Data Type Required Default Description
inc_discount bool No TRUE Define whether the returned value should include any active discount.
format bool No TRUE Define whether to format the returned value as a currency.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:int | (string if value is formatted).

Examples
Note: The returned example values below are displaying live data from the current cart session data.
total(TRUE, TRUE, FALSE) What is the current total, including any set discount? £0.00
total(FALSE, TRUE, FALSE) What is the current total, excluding any set discount? £0.00
total(TRUE, TRUE, TRUE) What is the internal total, including any set discount? £0.00
total(FALSE, TRUE, TRUE) What is the internal total, excluding any set discount? £0.00

item_summary_savings_total()

Returns the savings total of all item discounts.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
item_summary_savings_total(format, internal_value) Help
Name Data Type Required Default Description
format bool No TRUE Define whether to format the returned value as a currency.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:int | (string if value is formatted)

Examples
Note: The returned example values below are displaying live data from the current cart session data.
item_summary_savings_total(TRUE, FALSE) What is the current savings total of all items? £0.00
item_summary_savings_total(TRUE, TRUE) What is the internal savings total of all items? £0.00

summary_savings_total()

Returns the savings total of all summary discounts.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
summary_savings_total(format, internal_value) Help
Name Data Type Required Default Description
format bool No TRUE Define whether to format the returned value as a currency.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:int | (string if value is formatted)

Examples
Note: The returned example values below are displaying live data from the current cart session data.
summary_savings_total(TRUE, FALSE) What is the current savings total of the cart summary? £0.00
summary_savings_total(TRUE, TRUE) What is the internal savings total of the cart summary? £0.00

cart_savings_total()

Returns the savings total of all item and summary discounts and reward vouchers applied to the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
cart_savings_total(include_vouchers, format, internal_value) Help
Name Data Type Required Default Description
include_vouchers bool No TRUE Define whether to include the savings of any reward vouchers that are applied to the cart.
format bool No TRUE Define whether to format the returned value as a currency.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:int | (string if value is formatted)

Examples
Note: The returned example values below are displaying live data from the current cart session data.
cart_savings_total(TRUE, TRUE, FALSE) What is the current savings total of the entire cart? £0.00
cart_savings_total(TRUE, TRUE, TRUE) What is the internal savings total of the entire cart? £0.00

reward_voucher_total()

Returns the total of all reward vouchers applied to the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Reward vouchers cannot be set unless the reward point, discount and order tables are enabled.

Function Parameters
reward_voucher_total(format, internal_value) Help
Name Data Type Required Default Description
format bool No TRUE Define whether to format the returned value as a currency.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:int | (string if value is formatted)

Examples
Note: The returned example values below are displaying live data from the current cart session data.
reward_voucher_total(TRUE, FALSE) What is the current reward voucher total (savings total) of the cart summary? £0.00
reward_voucher_total(TRUE, TRUE) What is the internal reward voucher total (savings total) of the cart summary? £0.00

surcharge_total()

Returns the total of all surcharges applied to the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
surcharge_total(format, internal_value) Help
Name Data Type Required Default Description
format bool No TRUE Define whether to format the returned value as a currency.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:int | (string if value is formatted)

Examples
Note: The returned example values below are displaying live data from the current cart session data.
surcharge_total(TRUE, FALSE) What is the current surcharge total? £0.00
surcharge_total(TRUE, TRUE) What is the internal surcharge total? £0.00

total_rows()

Returns the total number of individual rows within the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
total_rows(format) Help
Name Data Type Required Default Description
format bool No TRUE Define whether to format the returned value.
Return Values

Failure:n/a

Success:int | (string if value is formatted)

Examples
Note: The returned example values below are displaying live data from the current cart session data.
total_rows(TRUE) How many different rows of items are there in the cart? 0

total_items()

Returns the total number of items within the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
total_items(format) Help
Name Data Type Required Default Description
format bool No TRUE Define whether to format the returned value.
Return Values

Failure:n/a

Success:int | (string if value is formatted)

Examples
Note: The returned example values below are displaying live data from the current cart session data.
total_items(TRUE) What is the total quantity of items in the cart? 0

total_weight()

Returns the total weight of items within the cart.
The weight value can be converted into different weight unit types by submitting a value to '$weight_type'.
Available weight types are 'gram', 'kilogram', 'avoir_ounce', 'avoir_pound', 'troy_ounce', 'troy_pound' and 'carat'.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
total_weight(weight_type, format, decimals) Help
Name Data Type Required Default Description
weight_type string No FALSE Defines the weight type that the total weight should be returned as.
Available weight types are 'gram', 'kilogram', 'avoir_ounce', 'avoir_pound', 'troy_ounce', 'troy_pound' and 'carat'.
format bool No TRUE Define whether to format the returned value as a weight.
decimals int No FALSE Defines the number of decimals to return the value with.
Return Values

Failure:n/a

Success:int | (string if value is formatted)

Examples
Note: The returned example values below are displaying live data from the current cart session data.
total_weight(FALSE, TRUE, FALSE) What is the total weight of the items in the cart, displayed using the cart default weight settings? 0g
total_weight('kilogram', TRUE, 2) What is the total weight of the items in the cart, displayed in Kilograms to 2 decimal points? 0.00kg

total_reward_points()

Return the total reward points earnt from items within the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
total_reward_points(format) Help
Name Data Type Required Default Description
format bool No TRUE Define whether to format the returned value.
Return Values

Failure:n/a

Success:int | (string if value is formatted)

Examples
Note: The returned example values below are displaying live data from the current cart session data.
total_reward_points(TRUE) What is the total number of reward points currently earnt from items in the cart? 0

cart_taxable_value()

Returns the total value of taxable items (excluding tax) within the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
cart_taxable_value(format, internal_value) Help
Name Data Type Required Default Description
format bool No TRUE Define whether to format the returned value as a currency.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:int | (string if value is formatted)

Examples
Note: The returned example values below are displaying live data from the current cart session data.
cart_taxable_value(TRUE, FALSE) What is the current total taxable value of items and shipping in the cart? £0.00
cart_taxable_value(TRUE, TRUE) What is the internal total taxable value of items and shipping in the cart? £0.00

cart_non_taxable_value()

Returns the total value of non-taxable items within the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
cart_non_taxable_value(format, internal_value) Help
Name Data Type Required Default Description
format bool No TRUE Define whether to format the returned value as a currency.
internal_value bool No FALSE Define whether to return the value using the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:int | (string if value is formatted)

Examples
Note: The returned example values below are displaying live data from the current cart session data.
cart_non_taxable_value(TRUE, FALSE) What is the current total non-taxable value of items and shipping in the cart? £0.00
cart_non_taxable_value(TRUE, TRUE) What is the internal total non-taxable value of items and shipping in the cart? £0.00