WordPress at Your Fingertips
function is not described

WC_Shipping_Legacy_Flat_Rate::calc_percentage_adjustment() public WC 1.0

Deprecated from version 2.4.0. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Calculate the percentage adjustment for each shipping rate.

{} It's a method of the class: WC_Shipping_Legacy_Flat_Rate{}

No Hooks.

Return

float.

Usage

$WC_Shipping_Legacy_Flat_Rate = new WC_Shipping_Legacy_Flat_Rate();
$WC_Shipping_Legacy_Flat_Rate->calc_percentage_adjustment( $cost, $percent_adjustment, $percent_operator, $base_price );
$cost(float) (required)
Cost.
$percent_adjustment(float) (required)
Percent adjusment.
$percent_operator(string) (required)
Percent operator.
$base_price(float) (required)
Base price.

Changelog

Deprecated 2.4.0

Code of WC_Shipping_Legacy_Flat_Rate::calc_percentage_adjustment() WC 5.9.0

public function calc_percentage_adjustment( $cost, $percent_adjustment, $percent_operator, $base_price ) {
	if ( '+' === $percent_operator ) {
		$cost += $percent_adjustment * $base_price;
	} else {
		$cost -= $percent_adjustment * $base_price;
	}
	return $cost;
}