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
Tested by invoking the mutation addCartItems with and without "selectedFulfillmentType" and the results had the group created separately
Sample
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