Skip to content

Instantly share code, notes, and snippets.

@rwkyyy
Created September 21, 2018 09:14
Show Gist options
  • Save rwkyyy/80254548374ffeab7a95bec03e37f7c6 to your computer and use it in GitHub Desktop.
Save rwkyyy/80254548374ffeab7a95bec03e37f7c6 to your computer and use it in GitHub Desktop.
Show number of failed orders
add_action( 'woocommerce_admin_order_data_after_order_details', 'failed_orders_evd', 10, 2 );
function failed_orders_evd( $order ) {
$customer_orders = get_posts( array(
'numberposts' => -1,
// 'meta_key' => '_customer_user',
'meta_value' => $order->get_billing_email(),
'post_type' => 'shop_order',
'post_status' => array('wc-failed'),
) );
$orders_count = '<strong style="color:red">' . count($customer_orders) . '</strong>';
echo'<p>' . __( 'Failed orders: ' ) . $orders_count . '</p>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment