Exception thrown, when user logs in during checkout.

Created on 5 October 2020, almost 4 years ago
Updated 17 February 2023, over 1 year ago

Problem/Motivation

When anonymous user logs in during the checkout, and the authenticated user has already a cart which should be combined, there is an exception thrown, because the cart used during checkout is deleted:

Update existing 'commerce_order' entity while changing the ID is not supported

Steps to reproduce

- Add something to your cart as authenticated user.
- Logout
- Add something to your cart as anonymous user.
- During checkout, login with the login pane in the checkout.
- Get the exception above.

Proposed resolution

We should check in CartUnifier::combineCarts if the "$other_cart" is currently requested for checkout and if yes, use that one as main_cart.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany eyilmaz Berlin, Germany

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇭🇺Hungary fox mulder

    #8 🐛 Exception thrown, when user logs in during checkout. Fixed solves the main problem but i experience a new one when i put something in the cart as anonymous and log in in the first step of the checkout:
    Type: commerce_order
    Message: RuntimeException: Failed to start the session because headers have already been sent by ".../vendor/symfony/http-foundation/Response.php" at line 384. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 152 of .../vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php).

    is there anybody else who experiences this?

    core: 9.5.2
    commerce core: 8.x-2.33
    commerce_combine_carts: 8.x-1.0-rc2
    used patch: #8 🐛 Exception thrown, when user logs in during checkout. Fixed

Production build 0.71.5 2024