WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

WC_Shipping_Legacy_Local_Delivery::calculate_shipping() public WC 1.0

Calculate_shipping function.

{} Это метод класса: WC_Shipping_Legacy_Local_Delivery{}

Хуков нет.

Возвращает

Null. Ничего.

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

$WC_Shipping_Legacy_Local_Delivery = new WC_Shipping_Legacy_Local_Delivery();
$WC_Shipping_Legacy_Local_Delivery->calculate_shipping( $package );
$package(массив)
(default: array()).
По умолчанию: array()

Код WC_Shipping_Legacy_Local_Delivery::calculate_shipping() WC 4.7.1

<?php
public function calculate_shipping( $package = array() ) {
	$shipping_total = 0;

	switch ( $this->type ) {
		case 'fixed':
			$shipping_total = $this->fee;
			break;
		case 'percent':
			$shipping_total = $package['contents_cost'] * ( $this->fee / 100 );
			break;
		case 'product':
			foreach ( $package['contents'] as $item_id => $values ) {
				if ( $values['quantity'] > 0 && $values['data']->needs_shipping() ) {
					$shipping_total += $this->fee * $values['quantity'];
				}
			}
			break;
	}

	$rate = array(
		'id'      => $this->id,
		'label'   => $this->title,
		'cost'    => $shipping_total,
		'package' => $package,
	);

	$this->add_rate( $rate );
}