Change the WooCommerce Price Display

Price display is an important area of the WooCommerce product page. Customers check out the prices and carry out price and product comparison before buying the products. Thus, the request to change WooCommerce price display is a common store alteration.

Add this following line of code at the end of your theme’s functions.php file of your active child theme (or theme) and Save the file.

      function change_product_price_display( $price ) {
		$price .= 'per Product';
		return $price;
	}
	add_filter( 'woocommerce_get_price_html', 'change_product_price_display' );
	add_filter( 'woocommerce_cart_item_price', 'change_product_price_display' );
	add_filter( 'woocommerce_cart_item_subtotal', 'change_product_price_display' ); 
         add_filter( 'woocommerce_cart_subtotal', 'change_product_price_display' ); 
           add_filter( 'woocommerce_cart_total', 'change_product_price_display' ); 

Single Product Price Display

If you want to specifically change the price display for a particular product than this can be done with the same filters, as they’ll also pass additional arguments for you to conditionally change the price.

Add this following line of code at the end of your theme’s functions.php file of your active child theme (or theme) and Save the file.

function change_product_html( $price_html, $product ) {
 if ( 301 === $product->id ) {
 $price_html = '$50.00 per Unit';
 }

 return $price_html;
}
add_filter( 'woocommerce_get_price_html', 'change_product_html', 10, 2 );


function change_product_price_cart( $price, $cart_item, $cart_item_key ) {
 if ( 301 === $cart_item['product_id'] ) {
 $price = '$50.00 per Unit
(7-8 skewers per Unit)'; } return $price; } add_filter( 'woocommerce_cart_item_price', 'change_product_price_cart', 10, 3 );

Leave a Comment

Scroll to Top