Change Quantity
{exp:cartthrob:change_quantity} is an immediate-execution single tag. It updates quantity for one cart row and can optionally redirect. It is not a form tag.
See also:
Parameters
row_id
Required. Row ID of the cart item to update.
row_id="{segment_3}"
quantity
Required. Target quantity for the cart row.
quantity="{segment_4}"
return
Optional redirect URL after processing. If omitted, no redirect occurs.
return="cart/index"
Behavior and Constraints
- Looks up the cart item by
row_id. - If the row exists, calls
set_quantity(quantity)on that item. - Quantity handling is performed by item logic:
- input is sanitized
- value is normalized to absolute
- fractional quantities are rounded down when fractional quantities are disabled
- quantity
<= 0removes the row
- If the row is not found, no item is changed.
- Saves the cart.
- Redirects only when
returnis provided.
Examples
Row link from cart_items_info
{exp:cartthrob:cart_items_info}
<a href="{row_id_path=cart/change_quantity}/10">Change quantity to 10</a>
{/exp:cartthrob:cart_items_info}
Segment-driven update template
{exp:cartthrob:change_quantity row_id="{segment_3}" quantity="{segment_4}" return="cart/index"}
Set quantity to 0 (removes the row)
{exp:cartthrob:change_quantity row_id="{segment_3}" quantity="0" return="cart/index"}
Update without redirect
{exp:cartthrob:change_quantity row_id="{segment_3}" quantity="2"}