Skip to content

Commit

Permalink
Fix cart merging - old cart should merge into new one (#1920)
Browse files Browse the repository at this point in the history
This PR fixes cart merging (`lunar.cart.auth_policy: merge`) to ensure
that the current cart session is the one that has the line items applied
to it, before this PR it was being applied to the old cart which didn't
make sense.
  • Loading branch information
ryanmitchell authored Aug 22, 2024
1 parent 1fb63ce commit aaca618
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/Actions/Carts/AssociateUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function execute(Cart $cart, LunarUser $user, $policy = 'merge'): self
if ($policy == 'merge') {
$userCart = Cart::whereUserId($user->getKey())->active()->unMerged()->latest()->first();
if ($userCart) {
app(MergeCart::class)->execute($userCart, $cart);
app(MergeCart::class)->execute($cart, $userCart);
}
}

Expand Down

0 comments on commit aaca618

Please sign in to comment.