emoose_gmbh

Anzeige Anzahl an Kundenbestellungen in WC Bestelldetails

Jun 15th, 2021
1,055
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Anzeige Anzahl an Kundenbestellungen in WC Bestelldetails
  2. add_action( 'woocommerce_admin_order_data_after_order_details', 'get_specific_customer_orders', 10, 1 );
  3. function get_specific_customer_orders( $order ) {
  4.  
  5.     $customer_orders = get_posts( array(
  6.         'numberposts' => -1,
  7.         'meta_key'    => '_billing_email',
  8.         'meta_value'  => $order->get_billing_email(),
  9.         'post_type'   => 'shop_order',
  10.         'post_status' => array('wc-completed'),
  11.     ) );
  12.  
  13.     $orders_count = '<strong style="color:#ca4a1f">' . count($customer_orders) . '</strong>';
  14.  
  15.     echo'<br clear="all">
  16.    <p>' . __( 'Anzahl an Bestellungen: ' ) . $orders_count . '</p>';
  17. }
RAW Paste Data