Automattic\WooCommerce\Internal\Admin\WCPayPromotion
Init::set_gateway_top_of_list()
By default, new payment gateways are put at the bottom of the list on the admin "Payments" settings screen. For visibility, we want WooPayments to be at the top of the list.
Method of the class: Init{}
No Hooks.
Return
Array
. Modified ordering.
Usage
$result = Init::set_gateway_top_of_list( $ordering );
- $ordering(array) (required)
- Existing ordering of the payment gateways.
Init::set_gateway_top_of_list() Init::set gateway top of list code WC 9.6.0
public static function set_gateway_top_of_list( $ordering ) { $ordering = (array) $ordering; $id = WCPaymentGatewayPreInstallWCPayPromotion::GATEWAY_ID; // Only tweak the ordering if the list hasn't been reordered with WooCommerce Payments in it already. if ( ! isset( $ordering[ $id ] ) || ! is_numeric( $ordering[ $id ] ) ) { $is_empty = empty( $ordering ) || ( count( $ordering ) === 1 && $ordering[0] === false ); $ordering[ $id ] = $is_empty ? 0 : ( min( $ordering ) - 1 ); } return $ordering; }