WordPress at Your Fingertips
function is not described

WC_Payment_Gateway::get_order_total() protected WC 1.0

Get the order total in checkout and pay_for_order.

{} It's a method of the class: WC_Payment_Gateway{}

No Hooks.

Return

float.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_order_total();

Code of WC_Payment_Gateway::get_order_total() WC 5.5.2

<?php
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;
}