WC_Abstract_Order::calculate_shipping()publicWC 2.2

Calculate shipping total.

Метод класса: WC_Abstract_Order{}

Хуков нет.

Возвращает

float.

Использование

$WC_Abstract_Order = new WC_Abstract_Order();
$WC_Abstract_Order->calculate_shipping();

Список изменений

С версии 2.2 Введена.

Код WC_Abstract_Order::calculate_shipping() WC 8.7.0

public function calculate_shipping() {
	$shipping_total = 0;

	foreach ( $this->get_shipping_methods() as $shipping ) {
		$shipping_total += (float) $shipping->get_total();
	}

	$this->set_shipping_total( $shipping_total );
	$this->save();

	return $this->get_shipping_total();
}