WooCommerce comes with a lot of handy actions and filters which help us to modify WooCommerce without doing a lot of effort. Once can simply change product price or product subtotal on Order confirmation and email and thank you page using ‘woocommerce_order_formatted_line_subtotal’ hook filter.
function filter_woocommerce_order_formatted_line_subtotal( $subtotal, $item, $order ) {
// The instance of the WC_Product Object
$product = $item->get_product();
$product_id = $product->get_parent_id();
if(!empty($product_id)) {
if($product_id == '92' ) {
$subtotal = $subtotal.'<br/><small> per lesson </small>';
}
}
return $subtotal;
}
add_filter( 'woocommerce_order_formatted_line_subtotal', 'filter_woocommerce_order_formatted_line_subtotal', 20, 3 );
Happy Coding!.