| : |
|
-1,
'orderby' => 'date',
'order' => 'DESC',
'return' => 'ids',
'payment_method' => 'kco',
'date_created' => '>' . ( time() - MONTH_IN_SECONDS )
) );
$orders = $query->get_orders();
$amont_of_klarna_orders = count( $orders );
$amont_of_api_callback_orders = 0;
foreach( $orders as $order_id ) {
if( 'klarna_checkout_backup_order_creation' == get_post_meta( $order_id, '_created_via', true ) ) {
$amont_of_api_callback_orders++;
}
}
if( $amont_of_api_callback_orders > 0 ) {
$percent_of_orders = round( ($amont_of_api_callback_orders/$amont_of_klarna_orders) * 100 );
} else {
$percent_of_orders = 0;
}
if( $percent_of_orders >= 10 ) {
$status = 'error';
} else {
$status = 'yes';
}
echo '' . $percent_of_orders . '% (' . $amont_of_api_callback_orders . ' of ' . $amont_of_klarna_orders . ') of all orders payed via Klarna Checkout was created via API callback during the last month. This is a fallback order creation feature. You should aim for 0%.';
?>
|