This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
Accept User input for Fulfillment type in PDP & Fulfillment Grouping #45
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #MCOSS-52
Impact: breaking
Type: feature
Issue
Currently "shipping" is the only fulfillment group in the cart/order and the current logic is to add the items into the the first matching group (comparing supported fulfillment type and existing groups).
Solution
Code fixed to pass all the supported fulfillment types into the grouping logic. This ensures that all the required groups based on the types can be created. Additionally code changes made to add the item to all the matching groups (earlier it was just the first matching).
In case the UI provided the optional field of selected fulfillment type (assuming the user selected it in the PDP page), then this is considered and the item is added only to the selected group.
Breaking changes
As the item is added to all the supported groups, we have to explicitly make the user select one of the group during the checkout and remove the items from the remaining groups. In case the user has already selected the fulfillment type in previous screens and provided the selectedFulfillmentType in API, then the item is already grouped under a single one.
Testing
Sample