PHP 8.3 Deprecation Notice
-
When using the WC_Cart::add_fee() method, the following error is logged on the checkout page:
Deprecated: Creation of dynamic property WC_Order_Item_Fee::$legacy_fee is deprecated in /{PATH}/wp-content/plugins/woocommerce/includes/class-wc-checkout.php on line 568
This is on PHP 8.3, WC 9.3.3.
Example code:
function add_custom_fee( $cart )
{
if (is_admin() && !defined( 'DOING_AJAX' )) {
return;
}
if ($cart instanceof WC_Cart) {
$cart->add_fee( 'Processing Fee', 1.00, true );
}
}
add_action( 'woocommerce_cart_calculate_fees', 'add_custom_fee' );
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.