Add order counts by gateway

This commit is contained in:
Menaka S 2020-12-23 06:50:15 +05:30
parent 1a6835019a
commit e9804ea717
1 changed files with 12 additions and 0 deletions

View File

@ -413,6 +413,18 @@ class WC_Tracker {
} else {
$order_data[ $status ] += 1;
}
$gateway = $order->get_payment_method();
if ( ! empty( $gateway ) and in_array( $status, array( 'wc-completed', 'wc-refunded', 'wc-processing' ) ) ) {
$gateway = "gateway_" . $gateway;
if ( ! isset( $order_data[ $gateway ] ) ) {
$order_data[ $gateway ] = 1;
} else {
$order_data[ $gateway ] += 1;
}
}
}
}
$order_data['first'] = gmdate( 'Y-m-d H:i:s', $first );