Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: On cart update a new user is getting created when recently changed email of linked user. #3138

Closed
wijnenmik opened this issue Apr 12, 2023 · 2 comments
Assignees
Labels
bug commerce4 Issues related to Commerce v4

Comments

@wijnenmik
Copy link

wijnenmik commented Apr 12, 2023

What happened?

Description

When a customer / user has an active shopping cart linked and the user is changing his / her email address, the shopping cart event is getting triggered and a new user with the old email (probably the old cart where the old email is in) is getting created. So when you want to change your email back to the old one, this is impossible because there is already an account with that email address

Steps to reproduce

  1. Create a user in craft
  2. Make an active shopping cart for that user with an address linked
  3. Change the email of this user
  4. Trigger the _getCart function that will get the cart for the current session
  5. A new user is getting created with the old email before the email update

Expected behavior

The cart is getting updated with the new email and a new user is not getting created.

Actual behavior

A new user is getting created with the old email that is probably still linked in the active cart

Craft CMS version

4.4.6

Craft Commerce version

4.2.6

PHP version

8.1 / 8.0

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

@pdaleramirez
Copy link
Contributor

@wijnenmik I can replicate this issue. We'll look into this and give an update.

@nfourtythree
Copy link
Contributor

Hi @wijnenmik

This has now been fixed (by #3180) and will be included in the next release of Commerce.

To get this early, change your craftcms/commerce requirement in your project's composer.json to:

"require": {
  "craftcms/commerce": "dev-develop#25f8fee6971f0b2417e3170d46e1e193914f5a46 as 4.2.11",
  "...": "..."
}

Then run composer update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug commerce4 Issues related to Commerce v4
Projects
None yet
Development

No branches or pull requests

4 participants