WC_Cart::add_fee()publicWC 1.0

Add additional fee to the cart.

This method should be called on a callback attached to the woocommerce_cart_calculate_fees action during cart/checkout. Fees do not persist.

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

Хуков нет.


null. Ничего (null).


$WC_Cart = new WC_Cart();
$WC_Cart->add_fee( $name, $amount, $taxable, $tax_class );
$name(строка) (обязательный)
Unique name for the fee. Multiple fees of the same name cannot be added.
$amount(float) (обязательный)
Fee amount (do not enter negative amounts).
Is the fee taxable? .
По умолчанию: false)
The tax class for the fee if taxable. A blank string is standard tax class. ..
По умолчанию: ''

Код WC_Cart::add_fee() WC 8.7.0

public function add_fee( $name, $amount, $taxable = false, $tax_class = '' ) {
			'name'      => $name,
			'amount'    => (float) $amount,
			'taxable'   => $taxable,
			'tax_class' => $tax_class,