checkout-js icon indicating copy to clipboard operation
checkout-js copied to clipboard

Stale customerGroup in checkoutState

Open nowlena opened this issue 3 years ago • 0 comments

There's an issue with the customer.customerGroup data being stale as returned by checkoutState.data.getCustomer().

To reproduce the error:

  1. [back-office] ensure setting for "guest" customers is "-- No Group --"
  2. [checkout] login via the Customer step
  3. [checkout] once logged in, click the "Sign Out" button back at the Customer step
  4. [checkout] the customer.customerGroup data will now be stale (the previously logged in user's customer group will still be the value)

When the new state is merged into the existing customer object, if customerGroup is undefined it will leave the previous value there, causing our state to become stale / inaccurate.

When Guest customers have a customer group assigned the key gets updated correctly... this is because the customerGroup value for those users is defined. The merging of old state into new has no problem in this case.

This is likely an SDK issue, sorry if this is the wrong location repo to post within.

nowlena avatar Dec 14 '21 21:12 nowlena