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

Session variable 'chosen_shipping_methods' not updating #8807

Open
coycash opened this issue May 9, 2024 · 3 comments
Open

Session variable 'chosen_shipping_methods' not updating #8807

coycash opened this issue May 9, 2024 · 3 comments
Assignees
Labels
focus: checkout payments priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. type: bug The issue is a confirmed bug.

Comments

@coycash
Copy link

coycash commented May 9, 2024

Describe the bug

I have my own plugin which checks for the currently chosen shipping method on ajax update by way of the following code:

function wtld_checkout_addons_process() {
   $chosen_shipping_method_id = WC()->session->get( 'chosen_shipping_methods' )[0];
   // ...
}
add_action('woocommerce_checkout_process', 'wtld_checkout_addons_process');

This works on WooPayments 7.4.0 and earlier but after 7.5.0 $chosen_shipping_method_id is never updated/changed from the initial selection.

To Reproduce

  1. Go to 'Checkout' under WooPayments 7.5.0 or 7.6.0
  2. Change from 'flat_rate' to 'local_pickup' shipping method
  3. woocommerce_checkout_process hook still says 'flat_rate' is selected
  4. Rollback to WooPayments 7.4.0
  5. Works fine

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Firefox
  • Version: 125.0.3

Additional context

Originally posted woocommerce/woocommerce#47295

@coycash coycash added the type: bug The issue is a confirmed bug. label May 9, 2024
@pierorocca pierorocca added the priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. label May 10, 2024
@gpressutto5 gpressutto5 self-assigned this May 15, 2024
@gpressutto5
Copy link
Contributor

Hi @coycash! I'm using WooPayments 7.6.0, but I still can't reproduce the issue following the steps you provided. Should I do anything differently?

local_pickup

@coycash
Copy link
Author

coycash commented May 21, 2024

I can't quite see the bottom or your screen but it looks like you are submitting the order. I am not submitting the order and checking the ajax response but rather checking the value of 'chosen_shipping_methods' server side after an ajax call. Does that make sense?

@gpressutto5
Copy link
Contributor

Hi @coycash. Yes, I'm submitting the order because that's the only way I found to make the woocommerce_checkout_process hook run. Have you found another way?
Could you update the "To Reproduce" steps with everything we need to reproduce the issue or provide a repository that reproduces it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: checkout payments priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. type: bug The issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

4 participants