Código asociado al video
function bbloomer_show_sales_to_admin_325() { //https://businessbloomer.com/woocommerce-visual-hook-guide-archiveshopcat-page/ //https://docs.woocommerce.com/wc-apidocs/class-WC_Order.html global $product, $post; if ( current_user_can( 'administrator' ) ) { $print_h = 0; //https://developer.wordpress.org/reference/classes/wp_query/parse_query/ $orders = get_posts( array( 'post_type' => 'shop_order', 'post_status' => 'wc-completed', 'order' => 'DESC', //'posts_per_page' => '1', ) ); $num_compras = 0; foreach ($orders as $order) { $order = new WC_Order( $order->ID ); $items = $order->get_items(); foreach( $items as $item ) { $product_id = $item['product_id']; if ( $post->ID == $product_id ) { if ($print_h == 0){ echo ' <div class="sales-admin"> <b>Ventas:</b> <ol>'; $print_h = 1; } if ($num_compras <10) { echo ' <li>' . '('. $order->ID . ') #'. $item['quantity'] . ' ' . substr($order->get_date_completed(),0,10) . '</li> '; $num_compras = $num_compras + 1; } } } } if ($print_h == 1) { echo '</ol> </div> '; } } } add_action( 'woocommerce_after_shop_loop_item', 'bbloomer_show_sales_to_admin_325', 10 ); add_filter( 'woocommerce_email_subject_customer_processing_order', 'bbloomer_change_processing_email_subject', 10, 2 ); function bbloomer_change_processing_email_subject( $subject, $order ) { $subject = $order->get_billing_first_name() . ', Gracias por tu orden de ' . get_bloginfo( 'name', 'display' ); return $subject; }