CartThrob 9 documentation for ExpressionEngine commerce teams Visit CartThrob.com
CartThrob.com

Package (tag pair)

package outputs package/sub-item data from either:

  1. a cart row (row_id) that has sub-items, or
  2. a product entry (entry_id) that uses the cartthrob_package fieldtype.

This is a legacy compatibility tag pair.

See also:

Parameters

row_id

Cart row ID. When provided and the cart item has sub-items, package variables are built from that cart item.

row_id="{row_id}"

entry_id

Product entry ID to load package field data from a cartthrob_package field.

entry_id="123"

variable_prefix

Optional variable prefix used when rendering package field output.

variable_prefix="pkg:"

Variables

Variable set depends on source:

  • row_id source: sub-item variables from cartthrob_variables->sub_item_vars(...)
  • entry_id source: variables emitted by cartthrob_package fieldtype replace_tag

Behavior and Constraints

  1. If row_id is provided, tries to load that cart item.
  2. If row item has sub-items, outputs parsed sub-item variable rows.
  3. If no row-item data is available and entry_id is provided:
    • loads product entry
    • checks for cartthrob_package fieldtype on that channel
    • runs fieldtype preprocess/replace-tag rendering for package field content
  4. If no package data is found, returns no_results.

Notes:

  • This tag is legacy. Many package use cases are now handled via {package}/{packages} output inside cart_items_info and order_items.

Examples

From a cart row context:

{exp:cartthrob:package row_id="{row_id}"}
    {sub:title} ({sub:entry_id})<br>
{/exp:cartthrob:package}

From product entry package field context:

{exp:cartthrob:package entry_id="{entry_id}"}
    {title}<br>
{/exp:cartthrob:package}