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

Fastlane update shipping options & taxes when changing address (3541) #2665

Merged
merged 10 commits into from
Oct 7, 2024

Conversation

stracker-phil
Copy link
Collaborator

Description

This PR improves the Fastlane integration in the classic checkout page for existing Fastlane users ("Ryan flow").

After authentication via the OTP, the shipping address provided by Fastlane is used to determine shipping-options and taxes.

Technical details

  • When entering the Ryan flow, the values of existing checkout form fields are copied to an internal storage object -- see storeFormData()
  • When exiting the Ryan flow, the form fields are reset to their previous state -- see restoreFormData ()
  • When the shipping address changes in the Fastlane UI, the address is applied to the hidden form, and an Ajax call is triggered to update the cart details -- see syncDataToForm ()
  • This PR also includes some general improvements; mainly making the internal properties of FormFieldGroup private (#-prefix)

Steps to Test

  1. Go to the classic checkout page with Fastlane enabled
  2. Enter Ryan flow, by providing an existing Fastlane test-email; complete the OTP modal
  3. Check: When the Fastlane shipping address is displayed, the cart on the right side updates to display correct shipping and tax values
  4. Change the shipping address using the "Edit" link, and verify that the cart updates to display the new, correct shipping and tax values
🎥 Cart-sync in action

Keep an eye on the taxes on the right side:

2024-10-01_17-57-02.mp4

- Define class properties
- Change visibility of properties
- Add some comments
When Ryan flow starts, the values of the Woo-form are saved in an internal Map, and restored once the Ryan flow is disabled again (change email or select other payment gateway)
Main change of this branch. Tell WooCommerce about the shipping address used by Fastlane, so taxes and shipping options are correct
After restoring the original WooCommerce form, also trigger a cart refresh Ajax call
@InpsydeNiklas InpsydeNiklas added this to the 2.9.3 milestone Oct 3, 2024
@Dinamiko Dinamiko merged commit 3be4456 into trunk Oct 7, 2024
5 checks passed
@Dinamiko Dinamiko deleted the PCP-3541-sync-woo-with-axo-shipping branch October 7, 2024 08:39
@Dinamiko Dinamiko added the enhancement New feature or request label Oct 10, 2024
@Dinamiko Dinamiko mentioned this pull request Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AXO enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants