woocommerce / woocommerce-gateway-paypal-express-checkout

58 stars 65 forks source link

Get the package index dynamically #871

Closed james-allan closed 3 years ago

james-allan commented 3 years ago

Issue: 4106-gh-woocommerce/woocommerce-subscriptions


Description

In WC Subscriptions 3.1, the recurring cart package keys are now in the {$recurring_cart_key}_{$package_index} format (2021_05_25_weekly_0). When using the cart SPB, when you arrive on the complete PayPal order page, we copy the PayPal address data into the shipping packages, however we assumed the package index was always 0. This PR changes that so we get the package index dynamically using key().

Steps to test:

  1. With WC Subscriptions 3.1 and above, place a subscription product in the cart.
  2. On the cart page, use the PPEC smart payment buttons.
  3. Complete PayPal popup and when you arrive back on the Confirm your PayPal order page:
    • On trunk there will be 2 shipping methods displayed for the recurring cart. You will also get a lot of PHP warnings and errors.
    • On this branch, there's only 1 shipping method displayed and no errors.
Screen Shot 2021-05-31 at 1 56 38 pm

https://d.pr/i/lFCZea

Documentation

Changelog entry

Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted.

* fix - [WC Subscriptions 3.1] Update the shipping packages address using a dynamic key rather than assuming a 0 index.