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

Most Purchased (tag pair)

most_purchased returns purchased product entry IDs ordered by total sales.

This is a legacy reporting helper tag pair.

See also:

Parameters

sort

Sort direction for purchase totals.

Default: DESC

sort="DESC"

limit

Optional max number of entry IDs to return.

limit="10"

Variables

  • entry_id

Behavior and Constraints

  1. Loads purchased product totals from order_management_model->get_purchased_products.
  2. Uses total_sales ordering with selected sort and optional limit.
  3. Outputs parsed rows containing entry_id.

Examples

List top purchased entry IDs:

{exp:cartthrob:most_purchased limit="10" sort="DESC"}
    {entry_id}<br>
{/exp:cartthrob:most_purchased}

Use with channel entries:

{exp:cartthrob:most_purchased limit="5" sort="DESC"}
    {exp:channel:entries entry_id="{entry_id}" dynamic="no"}
        <p>{title}</p>
    {/exp:channel:entries}
{/exp:cartthrob:most_purchased}