Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared suggestion by client: Do not remove/add fees on every order save event #186

Open
Chetna1510 opened this issue Aug 28, 2023 · 0 comments
Assignees
Labels
client issue Reported by a client type: bug Something isn't working

Comments

@Chetna1510
Copy link

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/

@Chetna1510 Chetna1510 added type: bug Something isn't working client issue Reported by a client labels Aug 28, 2023
@Chetna1510 Chetna1510 added this to the Future Milestone milestone Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client issue Reported by a client type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants