Cart not successfully saving to session

Created on 22 October 2024, 2 months ago

Describe your bug or feature request.

As part of our checkout process, we send anonymous users to an SSO platform to login before reaching the payment step. We save the current cart to the session, so that on return from SSO we trigger the commerce_cart_user_login logic to apply anonymous carts in the current session to the newly logged in user. This had not been working.
The session was empty by the time we were triggering the redirection to SSO.
To fix this I have added in $this->session->save() in CartSession::addCartId, but this shouldn't be necessary and I'm unsure if it will have any unintended consequences.

If a bug, provide steps to reproduce it from a clean install.

In between creating the order and payment, send anonymous users to an SSO to login.

🐛 Bug report
Status

Needs review

Version

2.36

Component

Cart

Created by

🇬🇧United Kingdom mjmorley

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

Comments & Activities

  • Issue created by @mjmorley
  • 🇮🇱Israel jsacksick

    Well, considering no-one ever complained about this... I'm assuming this is caused by your project setup...
    We shouldn't be saving the session and I'm pretty sure this can have unintended consequences yes... So feel free to decorate the CartSession service and extend the addCartId() method to add your logic.

Production build 0.71.5 2024