WC_Shipping_Legacy_Flat_Rate::fee()publicWC 1.0

Work out fee (shortcode).

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

Хуков нет.

Возвращает

Строку.

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

$WC_Shipping_Legacy_Flat_Rate = new WC_Shipping_Legacy_Flat_Rate();
$WC_Shipping_Legacy_Flat_Rate->fee( $atts );
$atts(массив) (обязательный)
Shortcode attributes.

Код WC_Shipping_Legacy_Flat_Rate::fee() WC 7.1.0

public function fee( $atts ) {
	$atts = shortcode_atts(
		array(
			'percent' => '',
			'min_fee' => '',
		),
		$atts,
		'fee'
	);

	$calculated_fee = 0;

	if ( $atts['percent'] ) {
		$calculated_fee = $this->fee_cost * ( floatval( $atts['percent'] ) / 100 );
	}

	if ( $atts['min_fee'] && $calculated_fee < $atts['min_fee'] ) {
		$calculated_fee = $atts['min_fee'];
	}

	return $calculated_fee;
}