Magento 2 has NULL value for customer_id in the quotes table, even after the customer is logged in. Causing error “cartId is a required field” Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar ManaraTransactional emails are sent to my client after placing an order, but not to the customers. Why?Quote with no items - add to cart errorGetting strange result querying carts when using multiple search filter groupsAdd validated list of patients to customer account during checkoutMagento 2: Customer is_active field not working?Magento 2: Customer related notifications do not disappear even after refreshing the pageMagento 2: Logged-in customer can't place order with new shipping methodMagento 2.1.7 Upgrade to 2.2.x - Error converting field `value` in table `dgtl_quote_item_option`Error: The configuration parameter “formElement” is a required for “costum_attribute” fieldCron deleting expired quotes

Check if a string is entirely made of the same substring

How to open locks without disable device?

Co-worker works way more than he should

What was Apollo 13's "Little Jolt" after MECO?

How long after the last departure shall the airport stay open for an emergency return?

Align column where each cell has two decimals with siunitx

Is accepting an invalid credit card number a security issue?

What's parked in Mil Moscow helicopter plant?

Why did C use the -> operator instead of reusing the . operator?

Do I need to protect SFP ports and optics from dust/contaminants? If so, how?

What's the difference between using dependency injection with a container and using a service locator?

Putting Ant-Man on house arrest

How to keep bees out of canned beverages?

With indentation set to `0em`, when using a line break, there is still an indentation of a size of a space

A strange hotel

Additive group of local rings

How would I use different systems of magic when they are capable of the same effects?

Map material from china not allowed to leave the country

Error: Syntax error. Missing ')' for CASE Statement

Has a Nobel Peace laureate ever been accused of war crimes?

Does the set of sets which are elements of every set exist?

Israeli soda type drink

"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"

Would reducing the reference voltage of an ADC have any effect on accuracy?



Magento 2 has NULL value for customer_id in the quotes table, even after the customer is logged in. Causing error “cartId is a required field”



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraTransactional emails are sent to my client after placing an order, but not to the customers. Why?Quote with no items - add to cart errorGetting strange result querying carts when using multiple search filter groupsAdd validated list of patients to customer account during checkoutMagento 2: Customer is_active field not working?Magento 2: Customer related notifications do not disappear even after refreshing the pageMagento 2: Logged-in customer can't place order with new shipping methodMagento 2.1.7 Upgrade to 2.2.x - Error converting field `value` in table `dgtl_quote_item_option`Error: The configuration parameter “formElement” is a required for “costum_attribute” fieldCron deleting expired quotes



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















In a Magento 2 store, the checkout breaks when the user successfully logs in. When the user logs in and enters their address info, they receive no shipping quotes, and an error pops up saying "cartId is a required field".



The error is actually misleading: The underlying problem (discovered using xdebug) is that the quote table row for their cart is missing a customer_id. Instead, it has a NULL value for this field.



This means that:



  1. Magento calls this function


    MagentoQuoteModelResourceModelQuote::loadByCustomerId($quote, $customerId)



    * For the purpose of this example, $customerId = 1;




  2. Which runs a query:


    SELECT `quote`.*
    FROM `quote`
    WHERE ( `quote`.`customer_id` = 1 )
    AND ( store_id IN ( '1' ) )
    AND ( is_active = 1 )
    ORDER BY `updated_at` DESC
    LIMIT 1




  3. Of course, nothing is found, so an exception is thrown. The actual error is masked by a catch-all that does nothing -- the same one described in GitHub Issue #9744

    } catch (NoSuchEntityException $e)
    /* do nothing and just return null */



So my question is: Why would the quote not have a customer_id for the quote that the customer had created when adding products to the cart? The products still show up in the right sidebar, so the quote is still attached to their session, but for whatever reason, it lacks their customer_id after they log in.










share|improve this question
















bumped to the homepage by Community 5 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.





















    1















    In a Magento 2 store, the checkout breaks when the user successfully logs in. When the user logs in and enters their address info, they receive no shipping quotes, and an error pops up saying "cartId is a required field".



    The error is actually misleading: The underlying problem (discovered using xdebug) is that the quote table row for their cart is missing a customer_id. Instead, it has a NULL value for this field.



    This means that:



    1. Magento calls this function


      MagentoQuoteModelResourceModelQuote::loadByCustomerId($quote, $customerId)



      * For the purpose of this example, $customerId = 1;




    2. Which runs a query:


      SELECT `quote`.*
      FROM `quote`
      WHERE ( `quote`.`customer_id` = 1 )
      AND ( store_id IN ( '1' ) )
      AND ( is_active = 1 )
      ORDER BY `updated_at` DESC
      LIMIT 1




    3. Of course, nothing is found, so an exception is thrown. The actual error is masked by a catch-all that does nothing -- the same one described in GitHub Issue #9744

      } catch (NoSuchEntityException $e)
      /* do nothing and just return null */



    So my question is: Why would the quote not have a customer_id for the quote that the customer had created when adding products to the cart? The products still show up in the right sidebar, so the quote is still attached to their session, but for whatever reason, it lacks their customer_id after they log in.










    share|improve this question
















    bumped to the homepage by Community 5 hours ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      1












      1








      1








      In a Magento 2 store, the checkout breaks when the user successfully logs in. When the user logs in and enters their address info, they receive no shipping quotes, and an error pops up saying "cartId is a required field".



      The error is actually misleading: The underlying problem (discovered using xdebug) is that the quote table row for their cart is missing a customer_id. Instead, it has a NULL value for this field.



      This means that:



      1. Magento calls this function


        MagentoQuoteModelResourceModelQuote::loadByCustomerId($quote, $customerId)



        * For the purpose of this example, $customerId = 1;




      2. Which runs a query:


        SELECT `quote`.*
        FROM `quote`
        WHERE ( `quote`.`customer_id` = 1 )
        AND ( store_id IN ( '1' ) )
        AND ( is_active = 1 )
        ORDER BY `updated_at` DESC
        LIMIT 1




      3. Of course, nothing is found, so an exception is thrown. The actual error is masked by a catch-all that does nothing -- the same one described in GitHub Issue #9744

        } catch (NoSuchEntityException $e)
        /* do nothing and just return null */



      So my question is: Why would the quote not have a customer_id for the quote that the customer had created when adding products to the cart? The products still show up in the right sidebar, so the quote is still attached to their session, but for whatever reason, it lacks their customer_id after they log in.










      share|improve this question
















      In a Magento 2 store, the checkout breaks when the user successfully logs in. When the user logs in and enters their address info, they receive no shipping quotes, and an error pops up saying "cartId is a required field".



      The error is actually misleading: The underlying problem (discovered using xdebug) is that the quote table row for their cart is missing a customer_id. Instead, it has a NULL value for this field.



      This means that:



      1. Magento calls this function


        MagentoQuoteModelResourceModelQuote::loadByCustomerId($quote, $customerId)



        * For the purpose of this example, $customerId = 1;




      2. Which runs a query:


        SELECT `quote`.*
        FROM `quote`
        WHERE ( `quote`.`customer_id` = 1 )
        AND ( store_id IN ( '1' ) )
        AND ( is_active = 1 )
        ORDER BY `updated_at` DESC
        LIMIT 1




      3. Of course, nothing is found, so an exception is thrown. The actual error is masked by a catch-all that does nothing -- the same one described in GitHub Issue #9744

        } catch (NoSuchEntityException $e)
        /* do nothing and just return null */



      So my question is: Why would the quote not have a customer_id for the quote that the customer had created when adding products to the cart? The products still show up in the right sidebar, so the quote is still attached to their session, but for whatever reason, it lacks their customer_id after they log in.







      magento2 checkout quote






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 19 '17 at 19:00







      Eric Seastrand

















      asked Dec 19 '17 at 18:45









      Eric SeastrandEric Seastrand

      641717




      641717





      bumped to the homepage by Community 5 hours ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 5 hours ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          1 Answer
          1






          active

          oldest

          votes


















          0














          This issue stemmed from an exception being thrown (and masked) deep down in the quote address validation code. When the customer logs in, the quote must be re-saved to set their customer_id, and before saving, it must be validated. If the validation doesn't pass, the quote isn't saved, and so the customer_id field never gets populated, leading to the error mentioned in the question.



          This exception was being thrown because there was an include path (/usr/share/php) being added by the php/apache configuration, but due to open_basedir restrictions, it wasn't accessible. As a result, when the auto-loader tried to find the MagentoFrameworkValidatorEmailAddress.php class there, it encountered a warning (shown below).

          Warning: is_readable(): open_basedir restriction in effect. File(/usr/share/php/Zend/Validate/MagentoFrameworkValidatorEmailAddress.php) is not within the allowed path(s) : [my paths] in /mnt/www/magento2-documentroot/vendor/magento/zendframework1/library/Zend/Loader.php on line 186' (length=466)



          It's still not immediately evident to me why this warning caused an exception to be thrown, but the fix ended up being extremely simple: Just add this line to .htaccess to reset the include path, and prevent the auto-loader from looking in places it has no business looking in:




          php_value include_path "."



          From what I can tell, Magento 2 is self-contained, and adds its own relevant paths to the include path, so there shouldn't be any need for other include paths. If this is incorrect (or changes at a later date), please let me know in the comments.






          share|improve this answer























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f206439%2fmagento-2-has-null-value-for-customer-id-in-the-quotes-table-even-after-the-cus%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            This issue stemmed from an exception being thrown (and masked) deep down in the quote address validation code. When the customer logs in, the quote must be re-saved to set their customer_id, and before saving, it must be validated. If the validation doesn't pass, the quote isn't saved, and so the customer_id field never gets populated, leading to the error mentioned in the question.



            This exception was being thrown because there was an include path (/usr/share/php) being added by the php/apache configuration, but due to open_basedir restrictions, it wasn't accessible. As a result, when the auto-loader tried to find the MagentoFrameworkValidatorEmailAddress.php class there, it encountered a warning (shown below).

            Warning: is_readable(): open_basedir restriction in effect. File(/usr/share/php/Zend/Validate/MagentoFrameworkValidatorEmailAddress.php) is not within the allowed path(s) : [my paths] in /mnt/www/magento2-documentroot/vendor/magento/zendframework1/library/Zend/Loader.php on line 186' (length=466)



            It's still not immediately evident to me why this warning caused an exception to be thrown, but the fix ended up being extremely simple: Just add this line to .htaccess to reset the include path, and prevent the auto-loader from looking in places it has no business looking in:




            php_value include_path "."



            From what I can tell, Magento 2 is self-contained, and adds its own relevant paths to the include path, so there shouldn't be any need for other include paths. If this is incorrect (or changes at a later date), please let me know in the comments.






            share|improve this answer



























              0














              This issue stemmed from an exception being thrown (and masked) deep down in the quote address validation code. When the customer logs in, the quote must be re-saved to set their customer_id, and before saving, it must be validated. If the validation doesn't pass, the quote isn't saved, and so the customer_id field never gets populated, leading to the error mentioned in the question.



              This exception was being thrown because there was an include path (/usr/share/php) being added by the php/apache configuration, but due to open_basedir restrictions, it wasn't accessible. As a result, when the auto-loader tried to find the MagentoFrameworkValidatorEmailAddress.php class there, it encountered a warning (shown below).

              Warning: is_readable(): open_basedir restriction in effect. File(/usr/share/php/Zend/Validate/MagentoFrameworkValidatorEmailAddress.php) is not within the allowed path(s) : [my paths] in /mnt/www/magento2-documentroot/vendor/magento/zendframework1/library/Zend/Loader.php on line 186' (length=466)



              It's still not immediately evident to me why this warning caused an exception to be thrown, but the fix ended up being extremely simple: Just add this line to .htaccess to reset the include path, and prevent the auto-loader from looking in places it has no business looking in:




              php_value include_path "."



              From what I can tell, Magento 2 is self-contained, and adds its own relevant paths to the include path, so there shouldn't be any need for other include paths. If this is incorrect (or changes at a later date), please let me know in the comments.






              share|improve this answer

























                0












                0








                0







                This issue stemmed from an exception being thrown (and masked) deep down in the quote address validation code. When the customer logs in, the quote must be re-saved to set their customer_id, and before saving, it must be validated. If the validation doesn't pass, the quote isn't saved, and so the customer_id field never gets populated, leading to the error mentioned in the question.



                This exception was being thrown because there was an include path (/usr/share/php) being added by the php/apache configuration, but due to open_basedir restrictions, it wasn't accessible. As a result, when the auto-loader tried to find the MagentoFrameworkValidatorEmailAddress.php class there, it encountered a warning (shown below).

                Warning: is_readable(): open_basedir restriction in effect. File(/usr/share/php/Zend/Validate/MagentoFrameworkValidatorEmailAddress.php) is not within the allowed path(s) : [my paths] in /mnt/www/magento2-documentroot/vendor/magento/zendframework1/library/Zend/Loader.php on line 186' (length=466)



                It's still not immediately evident to me why this warning caused an exception to be thrown, but the fix ended up being extremely simple: Just add this line to .htaccess to reset the include path, and prevent the auto-loader from looking in places it has no business looking in:




                php_value include_path "."



                From what I can tell, Magento 2 is self-contained, and adds its own relevant paths to the include path, so there shouldn't be any need for other include paths. If this is incorrect (or changes at a later date), please let me know in the comments.






                share|improve this answer













                This issue stemmed from an exception being thrown (and masked) deep down in the quote address validation code. When the customer logs in, the quote must be re-saved to set their customer_id, and before saving, it must be validated. If the validation doesn't pass, the quote isn't saved, and so the customer_id field never gets populated, leading to the error mentioned in the question.



                This exception was being thrown because there was an include path (/usr/share/php) being added by the php/apache configuration, but due to open_basedir restrictions, it wasn't accessible. As a result, when the auto-loader tried to find the MagentoFrameworkValidatorEmailAddress.php class there, it encountered a warning (shown below).

                Warning: is_readable(): open_basedir restriction in effect. File(/usr/share/php/Zend/Validate/MagentoFrameworkValidatorEmailAddress.php) is not within the allowed path(s) : [my paths] in /mnt/www/magento2-documentroot/vendor/magento/zendframework1/library/Zend/Loader.php on line 186' (length=466)



                It's still not immediately evident to me why this warning caused an exception to be thrown, but the fix ended up being extremely simple: Just add this line to .htaccess to reset the include path, and prevent the auto-loader from looking in places it has no business looking in:




                php_value include_path "."



                From what I can tell, Magento 2 is self-contained, and adds its own relevant paths to the include path, so there shouldn't be any need for other include paths. If this is incorrect (or changes at a later date), please let me know in the comments.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 21 '17 at 14:06









                Eric SeastrandEric Seastrand

                641717




                641717



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f206439%2fmagento-2-has-null-value-for-customer-id-in-the-quotes-table-even-after-the-cus%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Magento 2 - Add success message with knockout Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Success / Error message on ajax request$.widget is not a function when loading a homepage after add custom jQuery on custom themeHow can bind jQuery to current document in Magento 2 When template load by ajaxRedirect page using plugin in Magento 2Magento 2 - Update quantity and totals of cart page without page reload?Magento 2: Quote data not loaded on knockout checkoutMagento 2 : I need to change add to cart success message after adding product into cart through pluginMagento 2.2.5 How to add additional products to cart from new checkout step?Magento 2 Add error/success message with knockoutCan't validate Post Code on checkout page

                    Fil:Tokke komm.svg

                    Where did Arya get these scars? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why did Arya refuse to end it?Has the pronunciation of Arya Stark's name changed?Has Arya forgiven people?Why did Arya Stark lose her vision?Why can Arya still use the faces?Has the Narrow Sea become narrower?Does Arya Stark know how to make poisons outside of the House of Black and White?Why did Nymeria leave Arya?Why did Arya not kill the Lannister soldiers she encountered in the Riverlands?What is the current canonical age of Sansa, Bran and Arya Stark?