Overriding Gateway Fields
The checkout_form tag has a
{gateway_fields} variable that outputs the customer and payment markup
required by the active gateway.
Choose one source of gateway fields
Use either the default {gateway_fields} output or your customized markup.
Do not render both. Duplicate inputs with the same name or id can make
CartThrob validate one field while the browser submits a different value.
Configure a Gateway Fields Template
- Go to CartThrob Settings → Payments and manage the gateway.
- Review the displayed checkout markup and the gateway’s required fields.
- Create an EE template containing your customized version of that markup.
- Select that template in Gateway Fields Template and save the gateway.
- Keep
{gateway_fields}incheckout_form. CartThrob embeds your configured template in its place.
The configured template is a full replacement for the default gateway output. It must include every required customer field, hosted-field container, hidden field, and gateway integration element.
Replace the variable directly
Alternatively, remove {gateway_fields} from checkout_form and paste the
complete customized markup directly into that form. Again, replace the
variable; do not supplement it with duplicate gateway-owned fields.
Populate ordinary customer fields with CartThrob variables so failed validation does not erase the customer’s values:
<label for="first_name">First name</label>
<input type="text" id="first_name" name="first_name" value="{first_name}">
With error_handling="inline", you can place a field-specific message beside
custom markup:
{if error:first_name}
<p class="error">{error:first_name}</p>
{/if}
See Gateway-generated fields and inline errors for the error-summary pattern and the behavior of generated fields.