I am trying to display the newly discounted price of line items inside my order emails (after editing it inside the actual order in wp-admin) - but using get_sale_price()
gives me a critical error, is there something else I should be using?
I've tried the following, and each gives me either the regular price (before discount) or a critical error
$product->get_total()
, $product->get_regular_price()
, $product->get_price();
<?php foreach( $order->get_items() as $item_id => $item ) {
$name = $item->get_name();
$product = $item->get_product();
$oldPrice = $product->get_subtotal();
$price = $order->get_formatted_line_subtotal( $item );
echo '<tr>';
echo '<td>'.$name.'</td>';
echo '<td>'.$oldPrice.'</td>';
echo '<td>'.$price.'</td>';
echo '</tr>';
} ?>
Thanks