WC_Shipping_Method::get_fee()publicWC 1.0

Get fee to add to shipping cost.

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

Хуков нет.

Возвращает

float.

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

$WC_Shipping_Method = new WC_Shipping_Method();
$WC_Shipping_Method->get_fee( $fee, $total );
$fee(строка|float) (обязательный)
Fee.
$total(float) (обязательный)
Total.

Код WC_Shipping_Method::get_fee() WC 8.7.0

public function get_fee( $fee, $total ) {
	if ( strstr( $fee, '%' ) ) {
		$fee = ( $total / 100 ) * str_replace( '%', '', $fee );
	}
	if ( ! empty( $this->minimum_fee ) && $this->minimum_fee > $fee ) {
		$fee = $this->minimum_fee;
	}
	return $fee;
}