checkout-js
checkout-js copied to clipboard
Stale customerGroup in checkoutState
There's an issue with the customer.customerGroup
data being stale as returned by checkoutState.data.getCustomer()
.
To reproduce the error:
- [back-office] ensure setting for "guest" customers is "-- No Group --"
- [checkout] login via the Customer step
- [checkout] once logged in, click the "Sign Out" button back at the Customer step
- [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.