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”Transactional 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

How to stop co-workers from teasing me because I know Russian?

Mysql fixing root password

Why are the 2nd/3rd singular forms of present of « potere » irregular?

What is the point of Germany's 299 "party seats" in the Bundestag?

A non-technological, repeating, visible object in the sky, holding its position in the sky for hours

Transfer over $10k

Bayes Nash Equilibria in Battle of Sexes

Is there a way to detect if the current member function is operating on an lvalue or rvalue?

Please, smoke with good manners

Stop and Take a Breath!

gnu parallel how to use with ffmpeg

get exit status from system() call

Binary Numbers Magic Trick

Unexpected email from Yorkshire Bank

Pressure to defend the relevance of one's area of mathematics

Lock in SQL Server and Oracle

Can fracking help reduce CO2?

Python "triplet" dictionary?

Why does nature favour the Laplacian?

Are Boeing 737-800’s grounded?

How can I record the screen and the rear camera on an iPhone simultaneously?

In gnome-terminal only 2 out of 3 zoom keys work

Advice on laptop battery life

Does a creature that is immune to a condition still make a saving throw?



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”


Transactional 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






























    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


























      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




















          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

                    Bulk add to cart function issuecart vs. mini cart issue … rwd themeRedirect Add to cart button to cart pageAdd to cart issue - Magento 2.1The requested Payment Method is not available When creating an orderM2: reason add-to-cart might not function in production modeAdd to cart issue in some android devicesMagento 2 - custom price can not add to subtotal and grand total after add to cartAdd to cart codeIssue with my cart module on pdp and cart pages, just keeps spinningBulk price and quantity update using rest api

                    БиармияSxpst500bh2ntaf! 3h2r