Filter
rpress_enabled_payment_gateways
On this page
Filters the list of enabled payment gateways.
Runs at the end of rpress_get_enabled_payment_gateways. The list contains the registered gateways that are enabled in the gateways setting, with the default gateway moved to the first position when sorting is on. Remove an entry to hide a gateway from checkout in certain conditions.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$gateway_list | array | Enabled gateways keyed by ID, in display order. |
Return value#
array. The enabled gateways.
Example#
function my_enabled_gateways( $gateway_list ) {
if ( rpress_get_cart_total() > 500 ) {
unset( $gateway_list['cash_on_delivery'] );
}
return $gateway_list;
}
add_filter( 'rpress_enabled_payment_gateways', 'my_enabled_gateways', 10, 1 );
Notes#
The same function is used to decide whether a gateway is active, so removing an entry also makes rpress_is_gateway_active return false for it.
Source#
Applied in:
includes/gateways/functions.php(line 71), inrpress_get_enabled_payment_gateways()
See also#
Was this page helpful?
