Answers for "woocommerce wordpress how to change product price"

3

how to get woocommerce product price

$_product->get_regular_price();
$_product->get_sale_price();
$_product->get_price();
Posted by: Guest on May-21-2020
0

WooCommerce Add Text after Price to Specific Product or Products

add_filter( 'woocommerce_get_price_html', 'njengah_text_after_price' );

function njengah_text_after_price($price){
	
	global $post;
		
	$product_id = $post->ID;
	
	$product_array = array( 1,2,3 );//add in the product IDs to add text after price
	
	if ( in_array( $product_id, $product_array )) {
		
		$text_to_add_after_price  = ' text to add after price for the specific products '; //change text in bracket to your preferred text 
		  
		  return $price .   $text_to_add_after_price;
		  
	}else{
		
		return $price; 
	}
		  
}
Posted by: Guest on June-21-2021

Code answers related to "woocommerce wordpress how to change product price"

Browse Popular Code Answers by Language