Cart Items Info
The cart_items_info tag works similar to the weblog entries module, and is intended to print out the contents of the customer’s cart. This tag outputs all details related to the contents of the cart, item details, subtotals, totals, shipping and tax figures (if available). This tag is usually a key component of a cart based site. This tag is what you will use to provide visitors an overview of what is in their cart, and generally what you will use as the base to access tools to edit & update products and quantities, and remove items from the cart.
| Action | Type | Output data comes from | Tag Output | Tag Structure |
|---|---|---|---|---|
| Output | Text | Session Data | Cart Info | Pair |
Table of Contents
Parameters
- orderby="title"
- sort="asc"
- number_format="yes"
- prefix="$"
- thousands_sep=","
- dec_point="."
- decimals="2"
- limit="1"
- offset="10"
orderby=
Orders the output. You can order by: title, quantity, entry_id, row_id, price, or item_options:your_option_name
orderby="title"
sort=
Sets the sort order
sort="asc"
number_format=
This will override default formatting to totals, subtotals, etc.
number_format="yes"
prefix=
number_format parameter must be set to "yes". If you'd like to override the default monetary identifier, use this parameter. $ is the default set for this item. Setting it to blank "" will allow you to use the cart_total in conditionals to test for a specific total amount.
prefix="$"
thousands_sep=
number_format parameter must be set to "yes". "," is the default. The primary use of this parameter is to account for countries that use a period rather than a comma as the thousands separator
thousands_sep=","
dec_point=
number_format parameter must be set to "yes". The default for this parameter is "." The primary use of this parameter is to account for countries that use a comma rather than a period as the decimal separator
dec_point="."
decimals=
number_format parameter must be set to "yes". "Decimals" sets the level at which decimals will be rounded in the total. If your items are priced at $1.23456, setting the decimal parameter to "2" would round that number to $1.23 "2" is the default.
decimals="2"
limit=
Limits the number of items shown
limit="1"
offset=
Handy if you want to paginate or otherwise offset the items returned.
offset="10"
Variables
- entry_id
- title
- url_title
- quantity
- row_id
- item_price
- item_subtotal
- item_shipping
- item_weight
- total_items
- total_unique_items
- cart_total
- cart_subtotal
- cart_tax
- cart_shipping
- cart_tax_name
- cart_discount
- cart_count
- entry_id_path
- row_id_path
- item_options:your_option
- item_options:your_option:option_name
- item_options:your_option:price
- switch
entry_id
Weblog or other product entry ID used to identify the product
121
title
Product's title
Grayskull Frontispiece
url_title
Product's URL title if product is stored in a weblog
grayskull_frontispiece
quantity
Quantity of product stored in cart
1
row_id
The row_id of the item.
2
item_price
Individual product price
22
item_subtotal
Product price multiplied by quantity
23.95
item_shipping
Shipping cost for this item
1.95
item_weight
The weight for this item.
15
total_items
Total items in cart
10
total_unique_items
Total unique items in cart.
19
cart_total
Total cost of items in cart
24.95
cart_subtotal
Subtotal of the cart before tax and shipping, after discounts have been applied
24.95
cart_tax
Amount of tax currently applied to cart contents
1.00
cart_shipping
Shipping amount applied to cart contents
.95
cart_tax_name
The label given to your tax setting.
Gloucester
cart_discount
The amount of the discount applied to the cart.
15
cart_count
The current iteration of the cart_items_info loop. Similar to {count} in a weblog entries tag.
1
entry_id_path
The entry_id path for the current item.
{entry_id_path=products/detail}
row_id_path
The row_id path for the current item.
{row_id_path=cart/delete_from_cart}
item_options:your_option
The specified item_option for the current item.
XL
item_options:your_option:option_name
The option_name for the specified item_option.
Extra Large
item_options:your_option:price
The price of the specified item_option.
$12.00
switch
{switch="option1|option2"} will allow you to easily create "zebra rows" by switching automatically between items. For instance
option1|option2Conditionals
if no_results
Since cart_items_info is a loop, if there is nothing in the cart, none of the variables above will be rendered. Use the no_results conditional to output alternate content when there is nothing in the cart.
{if no_results}There's nothing in your cart{/if}
Examples
{exp:cartthrob:cart_items_info}
<a href="{path='products/detail/{url_title}'}">{title}</a><br />
{/exp:cartthrob:cart_items_info}

