Cart Items Info (tag pair)
{exp:cartthrob:cart_items_info} loops over items currently in the cart and exposes item-level, cart-level, and helper variables for rendering cart pages.
A video tutorial on this tag is available.
See also:
Parameters
In addition to the parameters below, this tag supports Global Number Formatting.
orderby
Sort field. Defaults to title.
orderby="title"
You can sort by variables available in each row (for example title, quantity, entry_id, row_id, item_price, item_options:size, custom entry vars, and other exposed row keys).
Use orderby (no underscore). Legacy snippets may show order_by, but this tag reads orderby.
sort
Sort direction. Defaults to asc.
sort="desc"
limit
Maximum number of rows returned. Defaults to no limit.
limit="10"
offset
Skip this many rows before limit is applied. Defaults to 0.
offset="20"
entry_id
Filter cart rows by product entry ID. Pipe-delimited values are supported.
entry_id="456|455|454"
row_id
Filter cart rows by cart row ID. Pipe-delimited values are supported.
row_id="2|3|4"
plan_id
Filter rows by subscription plan ID stored in item meta. Pipe-delimited values are supported.
plan_id="1|3|7"
search:field_name
Additional filtering against row data (processed by apply_search_filters).
Contains matching:
// rows where product_tag contains "pickles"
search:product_tag="pickles"
// rows where product_tag contains at least one of these values
search:product_tag="pickles|shoes"
// rows where product_tag contains both values
search:product_tag="pickles&&shoes"
// rows where product_tag contains neither value
search:product_tag="not pickles|shoes"
// rows where product_tag does not contain all listed values together
search:product_tag="not pickles&&shoes"
Exact (=):
// rows where product_tag is exactly "pickles"
search:product_tag="=pickles"
// rows where product_tag is exactly one of these values
search:product_tag="=pickles|shoes"
// rows where product_tag is not exactly one of these values
search:product_tag="=not pickles|shoes"
Numeric operators:
// rows where numeric price is less than 10
search:price_numeric="<10"
// rows where numeric price is greater than or equal to 20
search:price_numeric=">=20"
Variables
Each loop row includes:
- Item variables from the cart item (
itemVars). - Cart/global variables merged into each row (
globalVariables+ cart info). - Loop helper variables added by this tag.
Common item variables:
entry_id,title,url_title,row_idquantity,inventoryitem_price,item_price:plus_tax,item_subtotal,item_subtotal:plus_taxitem_tax,item_total_taxitem_shipping,item_weightbase_price,base_price:plus_taxdiscounted_price,discounted_subtotal,discountno_tax,no_shipping
Numeric aliases (examples):
item_price:numeric,price:numericitem_price_plus_tax:numeric,price_plus_tax:numericitem_base_price:numeric,base_price:numericdiscounted_price:numeric,discount:numeric
Cart/global variables available in each row:
total_items,total_unique_itemscart_total,cart_subtotal,cart_subtotal:plus_taxcart_tax,cart_shipping,cart_shipping:plus_taxcart_discount,cart_tax_name,cart_weight,cart_id- customer info and
custom_data:*variables
Loop helpers:
cart_countcart_total_resultsfirst_rowlast_row
Options and subscription helpers:
item_options:*(for exampleitem_options:size)item_options(count of applied item options)selected_options(array payload for selected options)is_subscription/subscriptionflagssubscription_*values from stored subscription optionsdiscountspair (amount,amount:numeric,reason,coupon_code)categoriespair (when category data is available in the template context)
Path helpers:
entry_id_path=template/grouprow_id_path=template/group
Switch helper:
{switch="odd|even"}
Quick variable examples:
{exp:cartthrob:cart_items_info}
<p>Item: {title} ({entry_id})</p>
<p>Row ID: {row_id}</p>
<p>Qty: {quantity}</p>
<p>Item price: {item_price}</p>
<p>Item subtotal: {item_subtotal}</p>
<p>Cart total: {cart_total}</p>
<p>Loop count: {cart_count} of {cart_total_results}</p>
<p>Size option: {item_options:size}</p>
{/exp:cartthrob:cart_items_info}
Package/Sub-item Output
This tag supports package loops in the tag body using either {package}...{/package} or {packages}...{/packages}.
When an item has sub-items, the package pair exposes sub: variables, including:
sub:titlesub:entry_idsub:row_id(parent/child row format)sub:parent_idsub:child_idsub:countsub:first_rowsub:last_row
If an item is not a package, the package pair for that row is empty.
Conditionals
{if no_items}: explicit no-items branch supported by this tag.{if is_package}: current row has package sub-items.{if is_subscription}: current row is a subscription item.{if item_options}: current row has one or more item options.{if first_row}: first row in current result set.{if last_row}: last row in current result set.
Compatibility note: if {if no_items} is not used, standard {if no_results} fallback behavior still works through template no-results handling.
Behavior and Constraints
- Starts with all cart items.
- Applies direct filters in this order:
entry_idrow_idplan_id
- Builds row data (item vars + global/cart vars + package/sub-item vars).
- Sorts rows using
orderby+sort. - Applies
offsetandlimit. - Applies
search:*filters. - Adds loop helpers (
cart_count,cart_total_results,first_row,last_row). - Parses output.
Important nuance: because search:* runs after sort/offset/limit, filtered result size can be smaller than limit.
Examples
Basic cart loop
{exp:cartthrob:cart_items_info}
{if no_items}<p>There's nothing in your cart.</p>{/if}
<p>{title} x {quantity} = {item_subtotal}</p>
{/exp:cartthrob:cart_items_info}
Row-specific update/delete controls
{exp:cartthrob:cart_items_info}
<p>{title}</p>
<a href="{row_id_path=cart/change_quantity}/2">Set quantity to 2</a>
<a href="{row_id_path=cart/delete_from_cart}">Delete</a>
{/exp:cartthrob:cart_items_info}
Filter by entry and plan
{exp:cartthrob:cart_items_info entry_id="12|13" plan_id="3" orderby="entry_id" sort="desc"}
<p>{entry_id}: {title}</p>
{/exp:cartthrob:cart_items_info}
Search filters
{exp:cartthrob:cart_items_info search:title="not sample|test" search:price_numeric=">=20"}
<p>{title} - {item_price}</p>
{/exp:cartthrob:cart_items_info}
Package/sub-item output examples
{exp:cartthrob:cart_items_info}
<h4>{title}</h4>
{if is_package}
{package}
<p>Sub item: {sub:title} ({sub:row_id})</p>
{/package}
{/if}
{/exp:cartthrob:cart_items_info}
Zebra rows with switch
{exp:cartthrob:cart_items_info}
<div class="{switch='odd|even'}">{title}</div>
{/exp:cartthrob:cart_items_info}