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

Delete Vault Form (tag pair)

{exp:cartthrob:delete_vault_form} outputs an HTML confirmation form that deletes one saved payment method (vault record) for the current member.

This is a form tag (tag pair), and it is commonly used in checkout-related account flows.

See also:

Parameters

In addition to the tag-specific parameters below, this tag supports shared form parameters from global_form_settings (for example error_handling, show_errors, id, class, name, onsubmit, and enctype).

vault_id

Required vault record identifier to delete.

If vault_id is missing, invalid, or not owned by the current member, the tag returns no output.

vault_id="{segment_3}"

return

Return path used after action completion.

return="store/vaults/deleted"

secure_return

If truthy, return URLs are forced to HTTPS.

secure_return="yes"
logged_out_redirect

Used by logged-out guard behavior for this form.

logged_out_redirect="account/login"

Variables

This form includes global tag/form variables plus vault values from the matched vault record ($vault->toArray()).

Commonly used values include:

  • {name}
  • {token}
  • {primary}
{vault_gateway}

Gateway short name for the vault record, added explicitly by the tag.

Form Fields

  1. A hidden vault_id field is automatically injected by the tag.
  2. Typical usage is a confirmation view plus one submit button.
  3. You can display vault context variables (for example {name}, {vault_gateway}, {token}) before submission.

Behavior and Constraints

  1. vault_id must resolve to a member-owned vault record; otherwise no form output is returned.
  2. Logged-out guard behavior is applied for valid vault requests.
  3. Submit action flow (delete_vault_action) attempts to delete the matched vault record and then completes.
  4. One submission deletes at most one vault record.
  5. If no valid member-owned vault is found in action processing, nothing is deleted and action completes without deletion.

Examples

Basic delete confirmation:

{exp:cartthrob:delete_vault_form
  class="form-horizontal"
  vault_id="{segment_3}"
  return="store/vaults/deleted"}

  <p>{name}</p>
  <p>{vault_gateway}</p>
  <p>{token}</p>

  <input type="submit" value="Delete Payment Method" />
{/exp:cartthrob:delete_vault_form}

No explicit return path:

{exp:cartthrob:delete_vault_form vault_id="{segment_3}"}
  <p>Delete {name}?</p>
  <input type="submit" value="Delete" />
{/exp:cartthrob:delete_vault_form}