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

Duplicate Item

{exp:cartthrob:duplicate_item} is an immediate-execution single tag. It duplicates one existing cart row and can optionally redirect. It is not a form tag.

See also:

Parameters

row_id

Required. Row ID of the existing cart item to duplicate.

row_id="{segment_3}"

return

Optional redirect URL after processing. If omitted, no redirect occurs.

return="cart/my_template"

Behavior and Constraints

  1. Uses row_id to locate the source cart row.
  2. If the row exists, duplicates it as a new row and saves the cart.
  3. If the row does not exist, nothing is duplicated.
  4. One tag call duplicates one row.
  5. Redirects only when return is provided.

Note: current tag implementation reads row_id. Legacy snippets that pass entry_id are outdated and may not work as expected for this tag.

Examples

Duplicate from cart_items_info

{exp:cartthrob:cart_items_info}
    <a href="{path=cart/duplicate_item/{row_id}/cart/view_cart}">Duplicate {title}</a>
{/exp:cartthrob:cart_items_info}

Template target:

{exp:cartthrob:duplicate_item row_id="{segment_3}" return="{segment_4}/{segment_5}"}

Duplicate with explicit return

{exp:cartthrob:duplicate_item row_id="{segment_3}" return="cart/my_template"}

Duplicate without redirect

{exp:cartthrob:duplicate_item row_id="{segment_3}"}