Skip to content

Commit

Permalink
PWA-3214::mergeCart issue
Browse files Browse the repository at this point in the history
  • Loading branch information
glo82145 committed Jan 12, 2024
1 parent 52229b2 commit a4973fe
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/peregrine/lib/talons/SignIn/useSignIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const useSignIn = props => {
const handleSubmit = useCallback(
async ({ email, password }) => {
setIsSigningIn(true);
handleTriggerClick();

try {
// Get source cart id (guest cart id).
const sourceCartId = cartId;
Expand Down Expand Up @@ -98,14 +98,16 @@ export const useSignIn = props => {
});
const destinationCartId = await retrieveCartId();

// Merge the guest cart into the customer cart.
await mergeCarts({
variables: {
destinationCartId,
sourceCartId
}
});

if(destinationCartId != sourceCartId){
// Merge the guest cart into the customer cart.
await mergeCarts({
variables: {
destinationCartId,
sourceCartId
}
});
}

// Ensure old stores are updated with any new data.

await getUserDetails({ fetchUserDetails });
Expand Down

0 comments on commit a4973fe

Please sign in to comment.