Emails

WooCommerce Show Number Of Products Purchased In Emails

WooCommerce emails showing the total number of products purchased in the order

Pre-Requisites

There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About This Solution

This snippet counts the total number of products purchased in the order and outputs the total below the order details table.

add_action( 'woocommerce_email_after_order_table', 'ecommercehints_show_number_of_products_purchased_in_emails', 10, 4 );
function ecommercehints_show_number_of_products_purchased_in_emails( $order, $sent_to_admin, $plain_text, $email ) {
   	echo '<h2 style="color: #636363; padding-bottom:10px">Number of products purchased: ' . $order->get_item_count() . '</h2>';
}

Snippet Benefits

  • Show the total quantity of products ordered in the emails.

100 WooCommerce Conversion Rate Optimisation Tips

This field is for validation purposes and should be left unchanged.

Let’s collaborate!

Need to outsource WordPress development?

Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.

First Timer Here?

Sign up to receive 20% off on your first month with us.

26027
WELCOME OFFER