Skip to content
Docs
Get RestroPress

Filter

rpress_chosen_gateway

Updated
On this page

Filters the gateway ID chosen for the current checkout.

Runs at the end of rpress_get_chosen_gateway. The value comes from the payment-mode request parameter or the payment_mode cookie when that gateway is active, otherwise the default gateway. It is forced to manual when the cart subtotal is zero or less.

Parameters#

ParameterTypeDescription
$chosen_gatewaystringGateway ID.

Return value#

string. The gateway ID.

Example#

function my_chosen_gateway( $chosen_gateway ) {
	return $chosen_gateway;
}
add_filter( 'rpress_chosen_gateway', 'my_chosen_gateway', 10, 1 );

Notes#

The filter runs after the zero-subtotal override, so returning a different gateway applies to free orders as well.

Source#

Applied in:

  • includes/gateways/functions.php (line 340), in rpress_get_chosen_gateway()

See also#

Was this page helpful?