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

Invalid recurring shipping method with Apple / Google Pay when paying for multiple subscriptions #2837

Closed
mattallan opened this issue Jan 17, 2024 · 0 comments · Fixed by #3068
Assignees
Labels
type: bug The issue is a confirmed bug.

Comments

@mattallan
Copy link
Contributor

Originally reported in 4606-gh-woocommerce/woocommerce-subscriptions
Similar issue to Automattic/woocommerce-payments#8029


Describe the bug

When attempting to purchase multiple subscriptions of varying periods with Apple/Google Pay, you will get an "Invalid recurring shipping method." error:

image

After some initial investigation, I believe this issue is caused by Stripe's payment request handler unintentionally wiping the recurring shipping methods from the chosen_shipping_methods session when it calls WC()->shipping->reset_shipping(), which is called when calculating the shipping options to display in the Apple/Google Pay pop-ups.

Before we wipe/clear the chosen shipping methods, we store them in a variable here so I think to fix this we'll need to restore any other chosen shipping methods that were wiped.

Additional details

Example of shipping_method data from payment button $_POST:

Array
(
    [0] => free_shipping:2
)

Example from a default checkout process:

Array
(
    [0] => free_shipping:2
    [2024_04_12_every_3rd_month_0] => free_shipping:2
    [2024_03_12_every_2nd_month_0] => free_shipping:2
)

To Reproduce
Steps to reproduce the behavior:

  1. Install and activate the latest Woo Subscriptions plugin
  2. Enable/activate Apple Pay and Google Pay payment request buttons
  3. Create two subscription products with different billing periods (monthly and weekly)
  4. Add both subscription products to your cart and navigate to the checkout page
  5. Purchase the checkout with Google Pay
  6. Notice the error seen in the screenshot above

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • WordPress Version
  • WooCommerce Version
  • Stripe Plugin Version
  • Browser [e.g. chrome, safari] and Version
  • Any other plugins installed

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug The issue is a confirmed bug.
Projects
None yet
2 participants