J
J
Jokerrs5672022-01-13 01:31:33
WooCommerce
Jokerrs567, 2022-01-13 01:31:33

How to display total cost in woocommerce?

I'm trying to display the total cost next to the button. I paste the code in payment.php

<div class="woocommerce-order-overview__total total">
            <div><?php esc_html_e( 'Total:', 'woocommerce' ); ?></div>
            <div><strong><?php echo $order->get_formatted_order_total(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></strong></div>
          </div>

As a result, a critical error is displayed on the design page. What exactly is my mistake?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WP Panda, 2022-01-13
@wppanda5 WooCommerce

Are you sure that there is an order object in the payment template?
I'm not on my computer right now, but something tells me it's not there
https://github.com/woocommerce/woocommerce/blob/be...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question