Delete from Cart Form (tag pair)
{exp:cartthrob:delete_from_cart_form} outputs an HTML form that submits to delete_from_cart_action and removes one cart row when a row_id is provided.
See also:
Parameters
In addition to the items below, this tag also supports Global Form Parameters.
returnsecure_returnrow_idlogged_out_redirect(global form behavior via guarded CartThrob form tags)
return
Template path to redirect to when the action completes successfully.
return="store/cart"
secure_return
Uses secure return behavior for redirect handling.
secure_return="yes"
Variables
This tag parses with global tag variables (globalVariables(true)), including form/error values used by global form error handling.
Form Fields
row_id
Row ID of the cart item to remove. If row_id is missing, this action does not remove an item.
You can provide row_id either:
- as a hidden field in the form body
- as a tag parameter (
row_id="{row_id}")
Example hidden field:
<input type="hidden" name="row_id" value="{row_id}" />
Behavior and Constraints
1. The form validates through form_builder.
2. save_customer_info() runs before removal.
3. If the request includes row_id, one row is removed via remove_item(row_id).
4. If row_id is not present, no item is removed.
5. Start/end hooks are available:
- cartthrob_delete_from_cart_start
- cartthrob_delete_from_cart_end
6. Completion/redirect is handled through form builder success/error callbacks.
This form action removes by row_id only. Entry-ID/item-option matching behavior belongs to delete_from_cart, not this tag pair.
Examples
Remove row inside cart_items_info (installer pattern)
{exp:cartthrob:cart_items_info}
{exp:cartthrob:delete_from_cart_form return="store/cart"}
Title: {title}
<input type="hidden" name="row_id" value="{row_id}" />
<input type="submit" value="Delete Item" />
{/exp:cartthrob:delete_from_cart_form}
{/exp:cartthrob:cart_items_info}
Parameter-based row_id
{exp:cartthrob:cart_items_info}
{exp:cartthrob:delete_from_cart_form row_id="{row_id}" return="store/cart"}
<button type="submit">Remove {title}</button>
{/exp:cartthrob:delete_from_cart_form}
{/exp:cartthrob:cart_items_info}