Automattic\WooCommerce\Internal\Admin\Settings
PaymentsProviders::order_map_add_gateway
Add a new gateway to an order map with offline-awareness.
If the offline payment methods group is the last non-offline, non-suggestion entry, the gateway is placed above it. Otherwise, it is appended at the end.
This is the single source of truth for new gateway placement logic, used by both the display path (Payments) and the persistence path (enhance_order_map).
Метод класса: PaymentsProviders{}
Хуков нет.
Возвращает
Массив. The updated order map.
Использование
$PaymentsProviders = new PaymentsProviders(); $PaymentsProviders->order_map_add_gateway( $order_map, $id ): array;
- $order_map(массив) (обязательный)
- The payment providers order map.
- $id(строка) (обязательный)
- The gateway ID to add.
Код PaymentsProviders::order_map_add_gateway() PaymentsProviders::order map add gateway WC 10.8.1
public function order_map_add_gateway( array $order_map, string $id ): array {
if ( $this->is_offline_group_last( $order_map ) ) {
return Utils::order_map_add_at_order(
$order_map,
$id,
$order_map[ self::OFFLINE_METHODS_ORDERING_GROUP ]
);
}
return Utils::order_map_add_at_order( $order_map, $id, empty( $order_map ) ? 0 : max( $order_map ) + 1 );
}