WC_Shipping_Method::get_fee()publicWC 1.0

Get fee to add to shipping cost.

Method of the class: WC_Shipping_Method{}

No Hooks.

Return

float.

Usage

$WC_Shipping_Method = new WC_Shipping_Method();
$WC_Shipping_Method->get_fee( $fee, $total );
$fee(string|float) (required)
Fee.
$total(float) (required)
Total.

WC_Shipping_Method::get_fee() code 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;
}