Skip to content
Docs
Get RestroPress

Filter

rpress_default_gateway

Updated
On this page

Filters the default payment gateway ID.

Runs in rpress_get_default_gateway. The value is the default_gateway setting (paypal if unset), falling back to the first enabled gateway when the setting points to a gateway that is not active. It is used when no gateway has been chosen at checkout.

Parameters#

ParameterTypeDescription
$defaultstringDefault gateway ID.

Return value#

string. The default gateway ID.

Example#

function my_default_gateway( $default ) {
	if ( rpress_is_gateway_active( 'cash_on_delivery' ) && ! is_user_logged_in() ) {
		return 'cash_on_delivery';
	}
	return $default;
}
add_filter( 'rpress_default_gateway', 'my_default_gateway', 10, 1 );

Source#

Applied in:

  • includes/gateways/functions.php (line 113), in rpress_get_default_gateway()

See also#

Was this page helpful?