reactioncommerce / api-plugin-carts

Carts plugin for the Reaction API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build fulfillment groups mechanism makes it impossible to build custom groups

alex-haproff opened this issue · comments

Prerequisites

  • [ + ] Are you running the latest version?
  • [ + ] Are you able to consistently reproduce the issue?
  • [ + ] Did you search the issue queue for existing issue? Search issues

Issue Description

Currently every time the cart gets updated (add item, remove item, set shipping address etc) the transformAndValidateCart method is being called, which in turn calls updateCartFulfillmentGroups.
This works well when there is no need to build custom fulfillment groups or allow customer to place cart items in specific groups.
This is because updateCartFulfillmentGroups is destructive, it will iterate over each cart item to determine the group it should belong to based on the supported shipping type. The item ends up being re-allocated even if it was previously assigned to a specific group by the customer or some other underlying mechanism.

Possible Solution

In updateCartFulfillmentGroups determine if the items is already allocated to the group, if so, do not re-allocate.

Versions

2.x, 3.x

I think pulling in v1.2.0 of api-plugin-carts will fix this based on #5

@alex-haproff con you share how you were able to set multiple fulfillment groups.

This has been fixed