WooCommerce Show Product Unit Price

WooCommerce show product unit price on checkout

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

By default, WooCommerce only shows the product’s unit price (or price per item) only on the cart page. On the Checkout, Thank You page, Emails, and order view in My Account, the user is not shown the price per unit and instead they are shown the subtotal. For the most aesthetically pleasing solution, editing the template files would be the best option but this has it’s drawbacks when it comes to updates and security. This solution shows you how you can display each product’s unit price on the Checkout, Thank You page, Emails, and order view in My Account. This solution is particularly useful when customers are checking out with more than one quantity of an item and need to be reminded the individual price of a product (it’s single unit price) rather than the subtotal which is the unit price multiplied by the quantity.

				
					/**
* Snippet Name:     WooCommerce show the price per unit on the Checkout, Thank You page, Emails, and order view in My Account.
* Snippet Author:   ecommercehints.com
*/

// Show product unit price on the Thank You Page, Emails, and order view in My Account.
function ecommercehints_return_unit_price( $product ) {
   $unit_price = wc_price($product->get_price());
   if (!empty($unit_price )) {
      return '<br><small><strong>(Unit Price: ' . $unit_price . ')</strong></small>';
   } else {
      return '';
   }
}
add_action( 'woocommerce_order_item_meta_start', 'ecommercehints_show_unit_price_below_product_name', 10, 4 );
function ecommercehints_show_unit_price_below_product_name( $item_id, $item, $order, $plain_text ) {
   $product = $item->get_product();
   echo ecommercehints_return_unit_price( $product );
}

// Show Product Unit Price On The Checkout
add_filter( 'woocommerce_cart_item_subtotal', 'ecommercehints_show_unit_price_below_subtotal', 10, 3 );
function ecommercehints_show_unit_price_below_subtotal( $wc, $cart_item, $cart_item_key ) {
	if ( ! is_cart() ) { // The cart already shows unit price so no need to show it again here
		$unit_price = wc_price(get_post_meta($cart_item['product_id'] , '_price', true));
		return $wc . '<br><small><strong>(Unit Price: ' . $unit_price . ')<strong></small>';
	} else {
	return $wc;
	}
}
				
			

Product Unit Price Showing On Thank You Page

WooCommerce show product unit price on thank you page

Product Unit Price Showing On Emails

Product Unit Price Showing On Order View In My Account

Snippet Benefits

  • Make it clear how much customers are paying per product by displaying the unit price as well as the existing subtotal.
WooCommerce Conversion Rate Optimisation (CRO) eBook
100 WooCommerce Conversion Rate Optimisation Tips

Leave a Reply

If you are going to write code in the comments, please wrap it between code tags.

Your email address will not be published. Required fields are marked *

Other Recent Guides

Subscribe To Emails

Get exclusive WooCommerce tips that I only share with email subscribers

Join hundreds of other subscribers