Detailed explanation and result of the investigation https://github.com/magento/magento2/issues/23908#issuecomment-538087658
Hi @mehmetuygun. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.3-develop instance
- upcoming 2.3.x release
For more details, please, review the Magento Contributor Assistant documentation.
@mehmetuygun do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid
appears.[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description
label to the issue by yourself.
[ ] 3. Add Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.3-develop
branchDetails
- Add the comment @magento give me 2.3-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop
branch, please, add the label Reproduced on 2.3.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 5. Verify that the issue is reproducible on 2.2-develop
branch. Details
- Add the comment @magento give me 2.2-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.2-develop
branch, please add the label Reproduced on 2.2.x
[ ] 6. Add label Issue: Confirmed
once verification is complete.
[ ] 7. Make sure that automatic system confirms that report has been added to the backlog.
@magento give me 2.3.2 instance
Hi @mehmetuygun. Thank you for your request. I'm working on Magento 2.3.2 instance for you
Hi @mehmetuygun, here is your Magento instance.
Admin access: https://i-23908-2-3-2.instances.magento-community.engineering/admin
Login: admin
Password: 123123q
Instance will be terminated in up to 3 hours.
Hello @mehmetuygun. Thanks for applying. We've been not able to reproduce Your issue on a vanilla magento instance. Please confirm You are able to to so.
I couldn't reproduce issue on magento instance either.
After I adding $customerId = $this->customerSession->getId();
in to begging of the function private function doValidate(AddressInterface $address, ?int $customerId): void
in the file magento/module-quote/Model/QuoteAddressValidator.php
the error stop showing up. And I could pass to payment page. How is possible customerId passing as null? it happens when I logged in and trying place order with saved address.
@mehmetuygun, if an issue is not reproduced on a fresh magento instance, free from any custom code, third party extensions, etc., then it is not a core magento bug this repository is intended for reporting. Please refer to the Community Forums or the Magento Stack Exchange site for advice or general discussion about this issue. Thus we are supposed to close this issue but please feel free to reopen it if deem necessary. Thanks for applying.
This issue is related to this issue: https://github.com/magento/magento2/issues/23618
I created https://github.com/magento/magento2/issues/23618# and there is a reference to this issue. So I check and the first I see is that this issue is closed here as well.
I understand that you are eager to close issues to keep numbers low but clearly this issue can have a huge impact: Customers can not checkout.
Is there anyone from the magento core team that is willing to take time to find out what is the root of this issue as it is not entirely clear why people are getting this message.
We've been seeing this as well on a 2.3.2 install. Our data was imported from a Magento 1.9.x install using the Magento Data Migration Tool. We were originally suspecting something to do with the data migration, but it still happens when you create a new account. At the moment we're disabling our 3rd party modules one by one to see if we can narrow it down, but this behavior seems to have been around since before we added our 3rd party modules.
I imported the customer data via CSV as I have bad experiences with the data migration tool.
The account that had problems was a testing account. So I deleted it and re-created it. But it happened again after that with the new testing account (with the same email).
Disabled all third party modules and still seeing same behavior. Traced things back through the code and found some interesting things happening:
exception.log shows the error coming from
[2019-08-06 22:05:07] main.CRITICAL: Invalid customer address id 160022 {"exception":"[object] (Magento\Framework\Exception\NoSuchEntityException(code: 0): Invalid customer address id 160022 at .... vendor/magento/module-quote/Model/QuoteAddressValidator.php:79)"}
That's QuoteAddressValidator::doValidate(AddressInterface $address, ?int $customerId)
, which is being called by line 130 in the same file. The second parameter for doValidate is set as: $cart->getCustomerIsGuest() ? null : $cart->getCustomer()->getId()
However, $cart->getCustomerIsGuest() is reporting me as a guest, when in fact I'm not. I logged in during checkout, and I'm continuing to refresh the checkout page, so it should be pretty apparent by now that I'm logged in. It is actually showing me all of my addresses, so it clearly thinks I'm logged in.
Ultimately, getCustomerIsGuest() pulls the information from the quote table, which I checked and found that for my customer_id, my active quote had customer_is_guest column set to 1. I'm not sure how the quote (merged from my guest cart) ended up with customer_is_guest still set to 1, but after clearing it, the problem vanished (at least for now).
The following query helped me find the other quotes in the same situation:
SELECT entity_id, customer_id FROM quote WHERE customer_id != 0 AND customer_is_guest = 1;
Then I reset them to the proper status:
UPDATE quote SET customer_is_guest = 0 WHERE customer_id != 0 AND customer_is_guest = 1;
The only quotes I could find in this state belonged to test accounts. I'll continue with testing with 3rd party modules enabled, and comment back if I find anything else improperly messing with the customer_is_guest field.
@sbrendtro, this is a good catch! I was not getting this critical message. But I was having the same in the quote table customer_is_guest was 1 with this testing customer. Setting it to 0 fixed things.
The root cause is yet unclear. I will keep an eye on this.
@sbrendtro
Do you mean
UPDATE quote ...
rather than
UPDATE entity ...
?
@sbrendtro
Do you mean
UPDATE quote ...
rather than
UPDATE entity ...
?
Yes, thanks for pointing that out. Just edited my comment.
No, thank you for pointing out the fix for what was turning out to be a massive pain in the backside for a client!
@onepack I think you should put this solution in your issue too because I believe it will help many people including me.
This is an issue that effects both Magento 2.2.9 and 2.3.2
It is also pretty disturbing to see Magento team denies that such issue exist. I can also confirm that the issue occurs on a clean installation.
Thanks to @sbrendtro we corrected the issue on our shop but denying such important issues on an Enterprise solution is not acceptable on magento teams behalf.
Dear members of this conversation. Please provide the steps following which we can reproduce the issue on a vanilla Magento installation of 2.3-develop version - the issue will be immediately reopened and confirmed. Dear @onepack, we are not eager to close the issues. We just follow our workflow (please see details to step 4 of this comment above https://github.com/magento/magento2/issues/23908#issuecomment-515489471). Thank You all for understanding.
It is really hard to reproduce as this is not an existing issue for everyone. For example when i checked our production instance , we had 85 total user quote that was effected by the issue. We of course corrected the quote issue but a step by step way to reproduce it is extremely hard.
One day after correcting the quote's we have this issue back in place.
mysql> SELECT entity_id, customer_id FROM quote WHERE customer_id != 0 AND customer_is_guest = 1;
+-----------+-------------+
| entity_id | customer_id |
+-----------+-------------+
| 57600 | 313840 |
| 24340 | 397145 |
| 106394 | 483487 |
| 117654 | 483683 |
+-----------+-------------+
Magento seriously urgently release a patch for this issue as this is effecting many customers incomes and most are not possibly aware of the issue.
Just because Magento team choose to close close issues for keeping clean board doesn't mean that us Enterprise customers are going to loose money.
In no condition Magento should allow a Logged in customer quote assigned as a Guest customer. But this can happen because of . a weird logic Magento team choose to implement. This shouldn't happen at all.
@engcom-Bravo We have same problem with magento since the 1st day of launching. The magento team should take a look on how you implement quote validation with customer_is_guest
on quote and care how it's merging.
Here's a temporary workaround at the database level (USE WITH CAUTION). Since no one seems to be able to figure out where this is coming from, I figured I would use a MySQL trigger to prevent customer_is_guest
from being set anything but 0 when customer_id
is set. You'll want to do your own testing before putting this in production. But I can't think of any real risk, as customer_is_guest
should really never be set to true for a logged-in customer.... right?
DROP TRIGGER IF EXISTS quote_before_insert_fix_guest;
DROP TRIGGER IF EXISTS quote_before_update_fix_guest;
DELIMITER $$
CREATE TRIGGER quote_before_insert_fix_guest BEFORE INSERT ON quote
FOR EACH ROW BEGIN
IF (NEW.customer_id != 0 AND NEW.customer_is_guest != 0 ) THEN
SET NEW.customer_is_guest = 0;
END IF;
END$$
CREATE TRIGGER quote_before_update_fix_guest BEFORE UPDATE ON quote
FOR EACH ROW BEGIN
IF (NEW.customer_id != 0 AND NEW.customer_is_guest != 0 ) THEN
SET NEW.customer_is_guest = 0;
END IF;
END$$
DELIMITER ;
edited: Both triggers were on BEFORE UPDATE, changed the first one to BEFORE INSERT.
@sbrendtro i will like to ask a question , do you also use Redis for session management ?
@mertgokceimam has same problem while using redis caching the session. Well, any investigation?
No redis, we are using DB session storage.
On Mon, Aug 19, 2019, 10:58 AM mertgokceimam notifications@github.com
wrote:
@sbrendtro https://github.com/sbrendtro i will like to ask a question ,
do you also use Redis for session management ?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/magento/magento2/issues/23908?email_source=notifications&email_token=AAF4V3AUQDYJ7BN5UCN5XCLQFK7LJA5CNFSM4IHEVPE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4TN3RQ#issuecomment-522640838,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAF4V3EM4Y4ACSN3SB7R6V3QFK7LJANCNFSM4IHEVPEQ
.
Same here, no redis session caching.
I've been able ro replicate a weird issue, which may be realted to this one, but don't know the correct frontend steps to get this to happen.
You need:
once you get to the checkout and you log in, your cart is merged.
At that point, when you try to remove an item from the cart, the QuoteAddressValidator will always fail.
I've replaced the final function validateForCart with a temporary, and it does allow now to remove items from the cart.
public function validateForCart(CartInterface $cart, AddressInterface $address): void
{
$customer = $cart->getCustomer();
$customerId = $customer ? $customer->getId() : null;
$this->doValidate(
$address,
$customerId
);
}
This is a great find and fits in the way I was working. As I was testing I would always have products in the cart and would be busy coding or do other stuff on the backend. This would result in a session expiration so I would be logged out. Logging in again would create this issue with my test user.
But this could also happen in real-life situations when customers get logged out and will log in again in order to checkout.
Steps to reproduce:
When we check the quote table.
SELECT entity_id, customer_id FROM quote WHERE customer_id != 0 AND customer_is_guest = 1;
+-----------+-------------+
| entity_id | customer_id |
+-----------+-------------+
| 28 | 4 |
+-----------+-------------+
We're experiencing this on our sites, as well. The database solution @sbrendtro fixed our problem accounts for now, but we'd really like a more permanent solution.
@santhoshnsscoe, do I miss something:
? Thank You.
We had three more records show up in the quote table since Saturday marked with 1 for "customer_is_guest" but also had a customer_id entered (which seems to cause the error). I don't know if this makes a difference, but all three of them had more than an hour between the quote's 'created_at' datetime and the quote's 'updated_at' datetime.
Actually, there seems to be a correlation between these quotes that are erroring and having the 'is_persistent' column checked. We don't have a whole lot of quotes marked 'is_persistent', but all of the ones that include a customer_id while also marked 1 for 'customer_is_guest' (ie, the ones that seem to be causing this error) are marked as 'is_persistent'.
@santhoshnsscoe, do I miss something:
? Thank You.
I checked with base Magento installation, it is working fine. So, there is some problem in either external modules or some settings. Will test completely and will update here.
Make sure to enable persistant cart so you can re produce it.
@sbrendtro I had the same issue and changing customer_is_guest to a 0 solved it for me. Seems to be very sporadic and happened to two users. It also seems related to the persistent cart settings.
We had to debug this issue as well today on a 2.3.1 shop, thanks to all the helpful comment above and our investigation, this is a brief summary:
customer_is_guest
set to 1 on the quote
customer_is_guest
flag on the quotes (we've seen shops where hundreds of quotes existed where this is incorrect)Our current solution, was to add an after plugin to the getCustomerIsGuest
function of the Magento\Quote\Model\Quote
class. And do something like this:
public function afterGetCustomerIsGuest(QuoteModel $subject, $result)
{
$customer = $subject->getCustomer();
return $customer->getId() === null;
}
So instead of checking the flag from the database, we check if the customer's id is null or not to decide if a customer is a guest or not.
Now, this is only a workaround.
To fix this properly in Magento, two things need to happen in my opinion:
customer_is_guest
flags in the quote
table, so all existing quotes which are being prevented to go through the checkout start working again.I'm reopening this issue for now again (yes, I realise we still don't have steps to reproduce, but the issue seems to be very real).
Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid
appears.[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description
label to the issue by yourself.
[ ] 3. Add Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.3-develop
branchDetails
- Add the comment @magento give me 2.3-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop
branch, please, add the label Reproduced on 2.3.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 5. Add label Issue: Confirmed
once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi everyone. Incredible but I've just got reproduced the issue on a (n almost) vanilla. Need some additional recheck - not yet sure for 100% I'll have it reproduced once more. But anyway I'll be back with the results.
Updated Steps to reproduce. In fact, as I see now these steps to reproduce are scattered throughout the conversation. So theoretically I might have already gotten them if I were a bit more attentive (I bring my apologies for not being that) and it wouldn't have taken me that much time to come to it by myself. It seems to me I managed to reproduce the issue with slightly other steps as well but not regularly. The current steps will got the issue reproduced in any case.
@engcom-Bravo Thank you for verifying the issue.
Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:
"Reproduced on "
label(s) to this ticket based on verification resultOnce all required information is added, please add label "Issue: Confirmed"
again.
Thanks!
:white_check_mark: Confirmed by @engcom-Bravo
Thank you for verifying the issue. Based on the provided information internal tickets MC-21568
were created
Issue Available: @engcom-Bravo, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._
Great @engcom-Bravo !
Although, we've seen this problem happening on shops where the persistent cart functionality was never enabled, so there might be other ways to trigger this bug as well.
But it's good to already have one case documented properly 👍
Is Anyone reproduce the issue in Magento-2.3.2 ?
Please List the steps to reproduce it.
Hi, @vijay-prevaj. Have You already tried out these ones?
I'm not sure if this is appropriate, but can anyone provide further details of any workarounds that have been implemented right now? We are experiencing this issue on a daily basis, and it is tedious to run the script regularly as provided above.
I see that someone added a plugin to a class, but I'm not sure how to implement that. If anyone has specific code I could add in anywhere until this is resolved, I would sincerely appreciate it. Thank you.
@diode-dynamics: A colleague of mine wrote the following patch, which you can apply using https://github.com/cweagans/composer-patches/ to the magento/module-quote
composer package, this seems to work in our case.
Be aware that this is only a workaround, not a fix for the problem, the flag customer_is_guest
in the database will still be incorrect from time to time, the patch simply causes that flag to be not used and determines the fact if a customer is a guest or not based on the customer id.
@hostep thank you so much! Understood that this is only a workaround. I've applied the patch, so far it seems to be working. This is a huge help for us until this bug is fixed. Thanks again.
@hostep we are facing the same strange problem here. Unfortunately your Patch Link is leading to an empty page. Could you possibly repost your patch? That would be great. Thanks so much in advance
Hi, @vijay-prevaj. Have You already tried out these ones?
Hi @engcom-Bravo I tried it, but doesn't reproduce the issue in our magento instance.
Thank you
@diode-dynamics We didn't want things to break if our patch got overwritten, so we created two database triggers to catch the improper customer_is_guest
setting. I thought I posted this here, but apparently not. Remember, TEST, TEST, TEST before you add this to a production DB. Fixing in code is best, but until this fix is in a production release, I wanted to have a backup plan.
DELIMITER //
CREATE TRIGGER quote_before_insert_fix_guest BEFORE UPDATE ON quote
FOR EACH ROW BEGIN
IF (NEW.customer_id != 0 AND NEW.customer_is_guest != 0 ) THEN
SET NEW.customer_is_guest = 0;
END IF;
END//
CREATE TRIGGER quote_before_update_fix_guest BEFORE UPDATE ON quote
FOR EACH ROW BEGIN
IF (NEW.customer_id != 0 AND NEW.customer_is_guest != 0 ) THEN
SET NEW.customer_is_guest = 0;
END IF;
END//
DELIMITER ;
After adding these triggers, you will still need to reset the existing incorrect customer_is_guest
values.
UPDATE quote SET customer_is_guest = 0 WHERE customer_id != 0 AND customer_is_guest = 1;
@sbrendtro thank you for this additional information. We are facing the same problem and hope that Magento can fix this problem the soonest as it is really a very annoying bug.
Hi @sdzhepa. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.[ ] 2. Verify that the issue is reproducible on 2.3-develop
branchDetails
- Add the comment @magento give me 2.3-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop
branch, please, add the label Reproduced on 2.3.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.
Hello @mehmetuygun and @ffalkone
I just got a notification that the current issue has been fixed by the internal Magento team and in the scope of MC-21568
.
At this moment MC-21568
has passed code-review and now in the QA stage. I expect it will be delivered during the first part of the next week.
FYI: @sbrendtro @onepack @gilesbennett @ron-jomashop @hostep @BenItt
Thanks @sdzhepa !
Is something like this being considered as well: https://github.com/magento/magento2/pull/24917#issuecomment-539666218 (which was based on @sbrendtro's comments above)?
Because fixing the bug in itself is not enough, incorrect data on the current quotes in the database needs to get fixed as well I think?
@BenItt: the patch download still works over here, but if it doesn't in your case for some reason, here is its content:
```diff
diff --git a/Model/Quote.php b/Model/Quote.php
index 6ac6e7715ad..6703a0cac42 100644
--- a/Model/Quote.php
+++ b/Model/Quote.php
@@ -691,6 +691,11 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C
*/
public function getCustomerIsGuest()
{
This appears to be a related cause https://github.com/magento/magento2/pull/25307
@n2diving-dgx: hmm, I don't agree, those are two separate issues in my opinion.
Hi @mehmetuygun, @sdzhepa, @ffalkone.
Thank you for your report and collaboration!
The issue was fixed by Magento team. The fix was delivered into magento/magento2:2.3-develop
branch(es).
Related commit(s):
The fix will be available with the upcoming 2.3.4
release.
Hello All
FYI: @mehmetuygun @ffalkone @sbrendtro @onepack @gilesbennett @ron-jomashop @hostep @BenItt
The internal Magento team has delivered the fix for this issue in the scope of MC-21568
.
Previously I asked them took into account for fix and testing this https://github.com/magento/magento2/issues/23908#issuecomment-546057109 .
Now to be sure I would like to ask you for confirmation, is this fix OK for you?
or some cases were missed and we need to create a new issue or re-open this one with additional information
Thank you in advance
Hi,
I am facing this issue. Is this issue fixed?
Hi @mehmetuygun, @sdzhepa, @ffalkone.
Thank you for your report and collaboration!
The issue was fixed by Magento team. The fix was delivered into
magento/magento2:2.3-develop
branch(es).
Related commit(s):* [6f0623f3f0f95ecdb960f5de89371fb8c8d51abc](https://github.com/magento/magento2/commit/6f0623f3f0f95ecdb960f5de89371fb8c8d51abc)
The fix will be available with the upcoming
2.3.4
release.
I had the same problem, but it was random and not present for every customer.
I removed line 92 from ./vendor/magento/module-persistent/Model/QuoteManager.php and the problem appears to be resolved.
https://github.com/magento/magento2/commit/6f0623f3f0f95ecdb960f5de89371fb8c8d51abc
Magento 2.3.3 I have just come across this problem. Is there a step by step process to apply the fix wihle Magento are preparing 2.3.4 for launch mentioned in November? I'm using community edition.
As others, this problem is a nightmare to reproduce, however by all description is the same and the main common issues:
SELECT entity_id, customer_id FROM quote WHERE customer_id != 0 AND customer_is_guest = 1;
on the database and found it was only my own account cart, no other lines thank fullyA clear step by step process to temporarily fix this for a semi-technical magento user would be great!
Hi everybody,
(sorry for my poor english)
I doesn't understand if there is actually a solution for this issue...
There is someone (maybe @sbrendtro) that could help me ?
Thanks in advance !!!
In my case it had to do with the php version. PHP 7.2 caused this issue. When we switched to 7.1 the problem did not occur anymore.
Hi @sdzhepa
I would like to let you know @sdzhepa https://github.com/magento/magento2/issues/23908#issuecomment-546057109 This works for me. But After fixing database according to https://github.com/magento/magento2/pull/24917#issuecomment-539666218 (if the customer_id is not null in the quote table, customer_is_guest should be 0) But I don't need to make changes in codes.
With this https://github.com/magento/magento2/issues/23908#issuecomment-552400390 fix, I couldn't reproduce the issue again.
I have applied this fix https://github.com/magento/magento2/issues/23908#issuecomment-552400390
Thank you.
Hi @mehmetuygun, @sdzhepa, @ffalkone.
Thank you for your report and collaboration!
The issue was fixed by Magento team. The fix was delivered into
magento/magento2:2.3-develop
branch(es).
Related commit(s):The fix will be available with the upcoming
2.3.4
release.
I am able to reproduce this in 2.3.4
I use magento 2.3.3 and the underlying problem seems to be with the url persistent/index/unsetCookie/ when you use persistent shopping cart with remember me option enabled. When someone clicks not you? button at the top of a page, checkout page throws this error when saving address even if you log out and login again, it seems to persist.
A quick workaround, disable remember me option, clean storage cache and flush magento cache.
@sdzhepa this issue is still present in Magento 2.3.4, what details can I provide to you for more investigation?
Still an issue on Magento 2.3.4
Here is the full stack trace:
[2020-03-27 12:54:45] main.CRITICAL: Invalid customer address id 2 {"exception":"[object] (Magento\\Framework\\Exception\\NoSuchEntityException(code: 0): Invalid customer address id 2 at vendor/magento/module-quote/Model/QuoteAddressValidator.php:81)"} []
[2020-03-27 12:55:13] main.INFO: #0 vendor/magento/module-quote/Model/QuoteAddressValidator.php(132): Magento\Quote\Model\QuoteAddressValidator->doValidate(Object(Magento\Quote\Model\Quote\Address), NULL)
#1 vendor/magento/module-checkout/Model/ShippingInformationManagement.php(172): Magento\Quote\Model\QuoteAddressValidator->validateForCart(Object(Magento\Quote\Model\Quote\Interceptor), Object(Magento\Quote\Model\Quote\Address))
#2 vendor/magento/framework/Interception/Interceptor.php(58): Magento\Checkout\Model\ShippingInformationManagement->saveAddressInformation(720, Object(Magento\Checkout\Model\ShippingInformation))
#3 vendor/magento/framework/Interception/Interceptor.php(138): Magento\Checkout\Model\ShippingInformationManagement\Interceptor->___callParent('saveAddressInfo...', Array)
#4 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Checkout\Model\ShippingInformationManagement\Interceptor->Magento\Framework\Interception\{closure}(720, Object(Magento\Checkout\Model\ShippingInformation))
#5 generated/code/Magento/Checkout/Model/ShippingInformationManagement/Interceptor.php(26): Magento\Checkout\Model\ShippingInformationManagement\Interceptor->___callPlugins('saveAddressInfo...', Array, Array)
#6 [internal function]: Magento\Checkout\Model\ShippingInformationManagement\Interceptor->saveAddressInformation(720, Object(Magento\Checkout\Model\ShippingInformation))
#7 vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array)
#8 vendor/magento/module-webapi/Controller/Rest.php(188): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process(Object(Magento\Framework\Webapi\Rest\Request\Proxy))
#9 vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))
#10 vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array)
#11 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#12 generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(26): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array)
#13 vendor/magento/framework/App/Http.php(116): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#14 generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()
#15 vendor/magento/framework/App/Bootstrap.php(261): Magento\Framework\App\Http\Interceptor->launch()
#16 pub/index.php(40): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
PHP version 7.2.27
I am running the site on version 2.3.4, I got the same error.
I can also verify that we are seeing this issue on 2.3.4. The query mentioned earlier, repeated below does temporarily fix the issue for existing quotes, but new quotes still have the same issue:
UPDATE quote SET customer_is_guest =0 WHERE customer_id IS NOT NULL AND customer_is_guest =1;
UPDATE quote SET customer_is_guest =1 WHERE customer_id IS NULL AND customer_is_guest =0;
Also, unlike many of the comments above, we currently have Persistent Shopping Cart disabled.
Thanks for the feedback @vseager!
We still apply our patch on 2.3.4 shops, because I wan't able to find adequate proof that this issue was fixed on 2.3.4, despite the comment above saying so and because there was no database migration script added to fix older possibly incorrect quotes.
@engcom-Bravo: are the steps to reproduce still applicable on 2.3.4 or 2.4-develop? Or do we need to find other steps to reproduce the issue?
Still seeing this on new instance of 2.3.4. No clear steps, but after a few attempts it does happen
Hi @hostep. Your patch prevents customer creation when you create an order from Admin. (Create New Order -> Create New Customer).
I think it should be:
$customer = $this->getCustomer();
if ($customer && !$this->getIsSuperMode()) {
return is_null($customer->getId());
}
Path : vendor/magento/module-quote/Model/QuoteAddressValidator.php
$customerId = $this->customerSession->getId();
This code worked for me.
Re-opening this issue. seems like it was closed without any reason.
CC @sidolov
The same problem persists after upgrading to Magento 2.4.1
I have same problem too. After upgrading to Magento 2.4.1
Hopefully, this will be fixed within two years... :(
For people still struggling with this, if you delete the customer addresses from the Magento admin, the customer will then be able to use the checkout. The issue is caused from data corruption when a guest customer logs in. Deleting the address fixes the corrupted data.
@sidolov @gabrieldagama seems like priority for this issue was set incorrectly, it should be p2 or even p1 as the customer can't place an order in such case
@ihor-sviziev changed to P1, thank you for the clarification!
Most helpful comment
Disabled all third party modules and still seeing same behavior. Traced things back through the code and found some interesting things happening:
exception.log shows the error coming from
[2019-08-06 22:05:07] main.CRITICAL: Invalid customer address id 160022 {"exception":"[object] (Magento\Framework\Exception\NoSuchEntityException(code: 0): Invalid customer address id 160022 at .... vendor/magento/module-quote/Model/QuoteAddressValidator.php:79)"}
That's
QuoteAddressValidator::doValidate(AddressInterface $address, ?int $customerId)
, which is being called by line 130 in the same file. The second parameter for doValidate is set as:$cart->getCustomerIsGuest() ? null : $cart->getCustomer()->getId()
However, $cart->getCustomerIsGuest() is reporting me as a guest, when in fact I'm not. I logged in during checkout, and I'm continuing to refresh the checkout page, so it should be pretty apparent by now that I'm logged in. It is actually showing me all of my addresses, so it clearly thinks I'm logged in.
Ultimately, getCustomerIsGuest() pulls the information from the quote table, which I checked and found that for my customer_id, my active quote had customer_is_guest column set to 1. I'm not sure how the quote (merged from my guest cart) ended up with customer_is_guest still set to 1, but after clearing it, the problem vanished (at least for now).
The following query helped me find the other quotes in the same situation:
Then I reset them to the proper status:
The only quotes I could find in this state belonged to test accounts. I'll continue with testing with 3rd party modules enabled, and comment back if I find anything else improperly messing with the customer_is_guest field.