Checkout, Emails, My Account, Thank You Page

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 Emails

Product Unit Price Showing On Order View In My Account

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.

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 10% off on your first month with us.

26027
WELCOME OFFER