I'm a newbie, and I have this problem as it shows me $0.00 on the Order received page.
// Add Custom WooCommerce Checkout Message
add_action( 'woocommerce_thankyou', 'shop_message', 5 );
function shop_message( $order_id ) {
$totalamount = $woocommerce->cart->cart_contents_total;
echo '<p class="woocommerce-message">ORDER NUMBER: ' . $order_id . ' And Your Total Price: ' . WC()->cart->get_total() . ' </p>'; // Replace your message here
}
// Add Custom Woocommerce Checkout Message
add_action('woocommerce_thankyou', 'shop_message', 5);
function shop_message($order_id) {
$order = wc_get_order($order_id);
echo '<p class="woocommerce-message">ORDER NUMBER: ' . $order_id . ' And Your Total Price: ' . $order->get_total() . ' </p>'; // Replace your message here
}