Set Gateway
set_gateway is an immediate-execution helper tag that reads a gateway value from the request, stores it to cart customer info (when gateway selection is allowed), saves the cart, and redirects.
This is mainly useful as a lightweight endpoint template for gateway switching flows.
See also:
Parameters
return
Template path used for redirect after processing.
return="store/checkout"
Request Inputs
gateway (GET)
Gateway value is read from query string via ee()->input->get('gateway', true), then decrypted with ee('Encrypt')->decode(...).
After decode, Cartthrob_ prefix is removed before saving.
Behavior and Constraints
1. This tag does not read gateway from tag parameters; it reads it from request query string (GET).
2. Decoded gateway value is normalized by removing Cartthrob_ prefix.
3. Gateway is saved only when allow_gateway_selection config is enabled.
4. When saving is allowed, value is stored in customer_info('gateway') and cart is saved.
5. Redirect is always executed to create_url(return), regardless of whether gateway saving occurred.
6. This tag is a redirect/control helper and is not intended to render visible output.
Examples
Endpoint template (store/set_gateway):
{exp:cartthrob:set_gateway return="store/checkout"}
GET form pattern using encrypted gateway values from gateway_select:
<form method="get" action="{path=store/set_gateway}">
{exp:cartthrob:gateway_select name="gateway"}
<button type="submit">Use Gateway</button>
</form>
Direct URL pattern (gateway value must match expected encrypted format):
{path=store/set_gateway}?gateway={some_encrypted_gateway_value}