-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
update chosen payment method soon, in wc_ajax_update_order_review #29248
Conversation
so code hooked in cart totals calculation, like those calculating fees,can operate with the current value.
Hi @marian-kadanka - Thanks for the PR however I am not entirely sure what you mean by it does not set the payment method chosen at the time of the AJAX call? It does so here https://github.com/woocommerce/woocommerce/blob/trunk/includes/class-wc-ajax.php#L313 |
Hi @marian-kadanka , Thanks for your contribution and apologies for taking a long time to respond to your request. Can you please give more details about the setup of shipping and payment gateways (ideally with screenshots of your settings) so that we better understand your use case? From a high level, this makes sense in some cases, where, as you said, payment gateways depend upon the shipping method chosen. However, I could see it also working the other way around in some markets where shipping methods depend on the chosen payment type. That's why we'd like to have a good understanding of your specific use case and setup before proceeding further. Thanks, |
Hi @marian-kadanka, We're still lacking some clarity so, given how long this work has been sitting without an update, we'll go ahead and close it. Of course, if you are still interested in this please don't hesitate to create a new PR, or even start with a new enhancement request where we can discuss it (if you prefer) before deciding on the best approach. Thanks! |
All Submissions:
Changes proposed in this Pull Request:
I had to write code adding payment method based fee to the cart, during checkout, hooking into the woocommerce_cart_calculate_fees hook. I was hoping that value of WC()->session->get( 'chosen_payment_method' ) already reflects the new value, but it is not always the case, specifically in the case of payment methods available only for some of the shipping methods. In this case, during woocommerce_cart_calculate_fees run, the value of WC()->session->get( 'chosen_payment_method' ) is one posted with the AJAX call - the old payment method selected, not the one we are going to update based on the currently running wc_ajax_update_order_review AJAX request.
So to resolve this issue, let's update chosen payment method soon, so code hooked in cart totals calculation, like those calculating cart fees, can operate with the current value.
Other information:
Changelog entry
update chosen payment method soon, in wc_ajax_update_order_review