WPIntell

Source evidence

Php 8.2 WC_Cart_Fees_API bug

Orderable – Restaurant & Food Ordering System · support · 2024-09-13T20:45:00+00:00

complaintsentiment
highseverity
0.96relevance
3replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

4 / 32 rows with source links

12.5% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

28 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
jpollie unresolved
I was trouble shooting with WP_DEBUG on. Issue: Creation of dynamic property WC_Order_Item_Fee::$legacy_fee is deprecated in /plugins/woocommerce/includes/class-wc-checkout.php on line 568 Creation of dynamic property WC_Order_Item_Fee::$legacy_fee_key is deprecated in /plugins/woocommerce/includes/class-wc-checkout.php on line 569 The deprecated warnings you’re seeing are related to the dynamic properties WC_Order_Item_Fee::$legacy_fee and WC_Order_Item_Fee::$legacy_fee_key , which are being triggered when adding fees during the checkout process in WooCommerce. These properties have been deprecated since WooCommerce 4.4.0. Particularly in the class Orderable_Tip_Pro_Checkout (class-tip-pro-checkout.php), the following actions likely trigger the deprecated properties: checkout_apply_tip() and handle_apply_tip_on_checkout_block() : Both functions add fees using WC()->cart->add_fee() . This can cause the deprecated dynamic properties in WooCommerce to be created. update_percentage_tip() : When recalculating percentage-based fees, it manipulates the fees using WC()->cart->fees_api()->set_fees() . This may also indirectly trigger the creation of the deprecated properties. Solution: The plugin should update how it adds and manages fees to avoid triggering deprecated WooCommerce properties. Instead of using WC()->cart->add_fee() , the correct approach is to use the WC_Cart_Fees_API class ( WC()->cart->fees_api() ) to handle fee additions and updates. This will ensure compatibility with newer versions of WooCommerce and PHP. Hi @jpollie , Thank you for reaching out and bringing this to our attention. I will be forwarding this to our development team for further investigation, and we will get back to you once we have received any insights from them. Thank you! Hi @jpollie , Thanks for your patience! Just letting you know that our team is looking into this, so we can fix it in the following releases. Cheers! Hey @jpollie The deprecated warnings are due to WooCommerce moving away from dynamic properties. Instead of using WC()->cart->add_fee() , you should update your plugin to use WC()->cart->fees_api()->add_fee() from the WC_Cart_Fees_API class. Check your checkout_apply_tip() and handle_apply_tip_on_checkout_block() functions and refactor them to use the new API. Similarly, in update_percentage_tip() , ensure fee recalculations follow WooCommerce’s latest guidelines. Updating this should resolve the warnings and ensure future compatibility. 🚀 Regards: Shehzam This reply was modified 1 year, 2 months ago by shehzam2 .

Comments

3 shown
kennethbryanlim 2024-09-15T16:48:00+00:00

Hi @jpollie , Thank you for reaching out and bringing this to our attention. I will be forwarding this to our development team for further investigation, and we will get back to you once we have received any insights from them. Thank you!

Lloyd Rick Guyon 2024-09-17T00:48:00+00:00

Hi @jpollie , Thanks for your patience! Just letting you know that our team is looking into this, so we can fix it in the following releases. Cheers!

shehzam2 2025-03-15T15:34:00+00:00

Hey @jpollie The deprecated warnings are due to WooCommerce moving away from dynamic properties. Instead of using WC()->cart->add_fee() , you should update your plugin to use WC()->cart->fees_api()->add_fee() from the WC_Cart_Fees_API class. Check your checkout_apply_tip() and handle_apply_tip_on_checkout_block() functions and refactor them to use the new API. Similarly, in update_percentage_tip() , ensure fee recalculations follow WooCommerce’s latest guidelines. Updating this should resolve the warnings and ensure future compatibility. 🚀 Regards: Shehzam This reply was modified 1 year, 2 months ago by shehzam2 .