WC_Payment_Gateway::get_order_total
Get the order total in checkout and pay_for_order.
Метод класса: WC_Payment_Gateway{}
Хуков нет.
Возвращает
float.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_order_total();
Код WC_Payment_Gateway::get_order_total() WC Payment Gateway::get order total WC 10.9.4
protected function get_order_total() {
$total = 0;
$order_id = absint( get_query_var( 'order-pay' ) );
// Gets order total from "pay for order" page.
if ( 0 < $order_id ) {
$order = wc_get_order( $order_id );
if ( $order ) {
$total = (float) $order->get_total();
}
// Gets order total from cart/checkout.
} elseif ( 0 < WC()->cart->total ) {
$total = (float) WC()->cart->total;
}
return $total;
}