Skip to content

Commit

Permalink
NTR: load cart again if token has changed (#969)
Browse files Browse the repository at this point in the history
Co-authored-by: Vitalij Mik <vitalij.mik@dasistweb.de>
  • Loading branch information
BlackScorp and Vitalij Mik authored Mar 3, 2025
1 parent 9a16a8b commit a5294b7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Components/PaypalExpress/Route/FinishCheckoutRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,14 @@ public function finishCheckout(SalesChannelContext $context): FinishCheckoutResp
$mollieShippingAddress
);
}

$oldToken = $context->getToken();
# create new account or find existing and login
$this->paypalExpress->prepareCustomer($shippingAddress, $context, $acceptedDataProtection, $billingAddress);
$context = $this->paypalExpress->prepareCustomer($shippingAddress, $context, $acceptedDataProtection, $billingAddress);

# read a new card after login
if ($context->getToken() !== $oldToken) {
$cart = $this->cartService->getCalculatedMainCart($context);
}

# we have to update the cart extension before a new user is created and logged in, otherwise the extension is not saved
$mollieShopwareCart = new MollieShopwareCart($cart);
Expand Down

0 comments on commit a5294b7

Please # to comment.