You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
seems like since 2.10 your plugin removes (and readds) (gateway) fees on every save_post event. That logic is triggered by checkout-fees-for-woocommerce/includes/class-alg-wc-order-fees.php. Please don’t do it. That’s a very bad practice and causes a lot of incompatibilities with other plugins – updating fees should only happen in case of a recalculation event, e.g. woocommerce_order_before_calculate_taxes (and/or in case the order payment gateway changes). Furthermore instead of removing the fee items altogether (as in Alg_WC_Order_Fees::remove_fees()), retrieve/search for the existing fee order item if existent. If it does not yet exist, add a new item.
And please use Woo hooks, e.g. woocommerce_order_after_calculate_totals to do so in a standard-compliant way instead of using the save_post event. There is no need to trigger additional order save events.
Describe the bug
seems like since 2.10 your plugin removes (and readds) (gateway) fees on every save_post event. That logic is triggered by checkout-fees-for-woocommerce/includes/class-alg-wc-order-fees.php. Please don’t do it. That’s a very bad practice and causes a lot of incompatibilities with other plugins – updating fees should only happen in case of a recalculation event, e.g. woocommerce_order_before_calculate_taxes (and/or in case the order payment gateway changes). Furthermore instead of removing the fee items altogether (as in Alg_WC_Order_Fees::remove_fees()), retrieve/search for the existing fee order item if existent. If it does not yet exist, add a new item.
And please use Woo hooks, e.g. woocommerce_order_after_calculate_totals to do so in a standard-compliant way instead of using the save_post event. There is no need to trigger additional order save events.
Additional context
https://wordpress.org/support/topic/do-not-remove-add-fees-on-every-order-save-event/
The text was updated successfully, but these errors were encountered: