Gateway Select
gateway_select outputs an HTML <select> of checkout gateways available to the current cart/session context.
This is commonly used on checkout pages with checkout_form so customers can switch payment method.
See also:
Parameters
name
Input name for the <select>. Defaults to gateway.
name="gateway"
selected
Selected gateway value.
- Typically this is a gateway class short name (for example
Cartthrob_stripeor current{gateway}value from customer info). - If the value is encoded, the tag will decode and resolve it when possible.
If selected value is not valid for current available gateways, selection falls back to the configured default gateway.
selected=”{gateway}”
add_blank
Adds a blank --- option at the top.
add_blank="yes"
gateways
Restricts the dropdown to specific gateways using a pipe-delimited list of gateway short names.
gateways="stripe|mollie"
Notes:
- Values are matched against configured selectable gateways.
- If gateway selection is disabled in settings, this restriction is ignored and only default gateway is shown.
encrypt
Controls whether option values are encrypted.
- Default behavior: encrypted values (
encrypt="yes"/ omitted). Set
encrypt="no"for plain class-name values.encrypt=”no”
extra
Additional raw attributes appended to the <select>.
extra='data-role="gateway-select" aria-label="Payment Gateway"'
id
id attribute for the <select>.
id="gateway"
class
class attribute for the <select>.
class="checkout-gateway-select"
onchange
Inline JavaScript onchange attribute for the <select>.
onchange="refreshGatewayFields(this.value)"
Output
Returns an HTML <select> element with gateway options.
- Option labels are gateway titles (localized where available).
- Options are sorted alphabetically by label before rendering.
Behavior and Constraints
- If
allow_gateway_selectionis disabled, output is forced to a single default gateway option. - If cart contains subscription items, gateway options are filtered to subscription-capable gateways only.
- Option values are encrypted by default.
- If
gatewaysis provided, list is intersected with configured available gateways. selectedvalue is normalized against available options; invalid values fall back to default gateway.- Attributes from
id,class,onchange, andextraare merged onto the<select>.
Examples
Basic checkout usage:
{exp:cartthrob:gateway_select id="gateway"}
Keep selection in sync with saved customer gateway:
{exp:cartthrob:customer_info}
{exp:cartthrob:gateway_select id="gateway" selected="{gateway}"}
{/exp:cartthrob:customer_info}
Restrict selectable gateways and include a blank option:
{exp:cartthrob:gateway_select
id="gateway"
gateways="stripe|mollie"
add_blank="yes"
}
Plain (non-encrypted) option values for custom integrations:
{exp:cartthrob:gateway_select
id="gateway"
encrypt="no"
onchange="refreshGatewayFields(this.value)"
}