WC_Shipping_Method::get_fee
Get fee to add to shipping cost.
Method of the class: WC_Shipping_Method{}
No Hooks.
Returns
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() WC Shipping Method::get fee code WC 10.8.1
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;
}