Skip to content

@W-19454052 feat: fix behavior where sometimes shipping options don't auto-summarize#3345

Merged
sf-henry-semaganda merged 8 commits intodevelopfrom
shipping_methods_default_auto_advance
Sep 24, 2025
Merged

@W-19454052 feat: fix behavior where sometimes shipping options don't auto-summarize#3345
sf-henry-semaganda merged 8 commits intodevelopfrom
shipping_methods_default_auto_advance

Conversation

@sf-henry-semaganda
Copy link
Contributor

@sf-henry-semaganda sf-henry-semaganda commented Sep 23, 2025

Description

Fixed shipping method section expanding unnecessarily when default options are auto-selected. The section now remains collapsed (summary mode) when all shipments have valid shipping methods, improving the checkout user experience. Default shipping methods are automatically submitted to the basket when available, while preserving manual user selections.

demo video:

short_video.mov

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • Auto-submit default shipping methods to basket so shipping section stays collapsed when defaults are available.

How to Test-Drive This PR

  • Create a new registered shopper
  • Add any item to cart and start checkout (skip the cart page)
  • Enter shipping address and click "Continue to Shipping Method"
  • Observe the behavior:
    ✅ Expected - Shipping method section stays collapsed (summary mode) with default method auto-selected
    ❌ Previous - Shipping method section expanded (edit mode) even with default selected

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Sep 23, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@sf-henry-semaganda sf-henry-semaganda marked this pull request as ready for review September 23, 2025 18:49
@sf-henry-semaganda sf-henry-semaganda requested a review from a team as a code owner September 23, 2025 18:49
Copy link
Contributor

@patricksullivansf patricksullivansf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While i suspect this approach is functionally correct it bothers me that it duplicates the idea of the logic in this updateShipmentsWithoutMethods hook. Is there anyway to leverage that?

also the other flow assigns the default methods before reaching this merged selection partial. Since the gap we’re trifling to fill here is to catch shipments that are belatedly added during the previous multi ship step, is it possible to catch these cases there?

I’m not blocking this solution, just want to make s sure we’ve fully investigated the alternatives

@sf-henry-semaganda
Copy link
Contributor Author

While i suspect this approach is functionally correct it bothers me that it duplicates the idea of the logic in this updateShipmentsWithoutMethods hook. Is there anyway to leverage that?

also the other flow assigns the default methods before reaching this merged selection partial. Since the gap we’re trifling to fill here is to catch shipments that are belatedly added during the previous multi ship step, is it possible to catch these cases there?

I’m not blocking this solution, just want to make s sure we’ve fully investigated the alternatives

@patricksullivansf I have tried some other approaches - unified hook for both cart and checkout (race condition in checkout), or bake updateShipmentsWithoutMethods into orchestrateShipmentOperations for multi ship, plus explicitly call it on proceed in single ship scenarios; open to more ideas but none of them so far fix this in all scenarios the way the current implementation does.

Copy link
Contributor

@shauryemahajanSF shauryemahajanSF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good to me, but there a flakey unit test, worth looking looking into

test(�[32m'Can add address during checkout as a registered

@sf-henry-semaganda sf-henry-semaganda merged commit 8a753ae into develop Sep 24, 2025
42 of 44 checks passed
@sf-henry-semaganda sf-henry-semaganda deleted the shipping_methods_default_auto_advance branch September 24, 2025 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants