Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save spirit1977/57f1496488e75f0255e92c20bef18022 to your computer and use it in GitHub Desktop.
Save spirit1977/57f1496488e75f0255e92c20bef18022 to your computer and use it in GitHub Desktop.
//Anzeige Anzahl an Kundenbestellungen in WC Bestelldetails
add_action( 'woocommerce_admin_order_data_after_order_details', 'get_specific_customer_orders', 10, 1 );
function get_specific_customer_orders( $order ) {
$customer_orders = get_posts( array(
'numberposts' => -1,
'meta_key' => '_billing_email',
'meta_value' => $order->get_billing_email(),
'post_type' => 'shop_order',
'post_status' => array('wc-completed'),
) );
$orders_count = '<strong style="color:#ca4a1f">' . count($customer_orders) . '</strong>';
echo'<br clear="all">
<p>' . __( 'Anzahl an Bestellungen: ' ) . $orders_count . '</p>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment