Magento 2 Wishlist product add not working when user should in before login Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Add to wishlist without customer loginHow to add product to wishlist after login by guest customer?Magento call session object directly to get last added session messagesAdd to wishlist button not redirecting to login page while not logged inHow to create Guest Wishlist For MagentoProgrammatically add product to wishlist in Magento 2Product didn't added to wishlist after PATCH_SUPEE-9767 installed in version 1.9.2.1Working on ajax wishlist- click again to remove product from wishlistAdd To WishlistWishlist for guest in cart page not working shows “The requested cart item doesn't exist.'” in magento 2

What do you call the main part of a joke?

Can the Great Weapon Master feat's damage bonus and accuracy penalty apply to attacks from the Spiritual Weapon spell?

What are the diatonic extended chords of C major?

What is the meaning of 'breadth' in breadth first search?

Why is Nikon 1.4g better when Nikon 1.8g is sharper?

I am having problem understanding the behavior of below code in JavaScript

How come Sam didn't become Lord of Horn Hill?

Drawing without replacement: why is the order of draw irrelevant?

Is a ledger board required if the side of my house is wood?

Dating a Former Employee

What is this clumpy 20-30cm high yellow-flowered plant?

Is there a kind of relay that only consumes power when switching?

Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?

Effects on objects due to a brief relocation of massive amounts of mass

Can a new player join a group only when a new campaign starts?

Is grep documentation about ignoring case wrong, since it doesn't ignore case in filenames?

How would a mousetrap for use in space work?

How to compare two different files line by line in unix?

Most bit efficient text communication method?

Is it possible for SQL statements to execute concurrently within a single session in SQL Server?

Is it fair for a professor to grade us on the possession of past papers?

What is the difference between globalisation and imperialism?

Denied boarding although I have proper visa and documentation. To whom should I make a complaint?

Project Euler #1 in C++



Magento 2 Wishlist product add not working when user should in before login



Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Add to wishlist without customer loginHow to add product to wishlist after login by guest customer?Magento call session object directly to get last added session messagesAdd to wishlist button not redirecting to login page while not logged inHow to create Guest Wishlist For MagentoProgrammatically add product to wishlist in Magento 2Product didn't added to wishlist after PATCH_SUPEE-9767 installed in version 1.9.2.1Working on ajax wishlist- click again to remove product from wishlistAdd To WishlistWishlist for guest in cart page not working shows “The requested cart item doesn't exist.'” in magento 2



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








1















I am facing issue adding product in wishlist (magento version 2.2.3).



Here is scenario,



Step 1 :- Make sure customer not logged in.



Step 2 :- Go to product list page and click "Add to wishlist"



Step 3 :- it will redirected to login page.



Step 4 :- Now after login you can check product not added in wishlist.










share|improve this question




























    1















    I am facing issue adding product in wishlist (magento version 2.2.3).



    Here is scenario,



    Step 1 :- Make sure customer not logged in.



    Step 2 :- Go to product list page and click "Add to wishlist"



    Step 3 :- it will redirected to login page.



    Step 4 :- Now after login you can check product not added in wishlist.










    share|improve this question
























      1












      1








      1








      I am facing issue adding product in wishlist (magento version 2.2.3).



      Here is scenario,



      Step 1 :- Make sure customer not logged in.



      Step 2 :- Go to product list page and click "Add to wishlist"



      Step 3 :- it will redirected to login page.



      Step 4 :- Now after login you can check product not added in wishlist.










      share|improve this question














      I am facing issue adding product in wishlist (magento version 2.2.3).



      Here is scenario,



      Step 1 :- Make sure customer not logged in.



      Step 2 :- Go to product list page and click "Add to wishlist"



      Step 3 :- it will redirected to login page.



      Step 4 :- Now after login you can check product not added in wishlist.







      magento2 wishlist






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      Bablu BarmanBablu Barman

      214




      214




















          1 Answer
          1






          active

          oldest

          votes


















          0














          Generate new FormKey and replace for oldRequestParams Wishlist




          1. vendormagentomodule-wishlistHelperData.php

            just added below code in this file...

          use MagentoFrameworkAppObjectManager;

          use MagentoFrameworkDataFormFormKey;

          use MagentoFrameworkAppPageCacheFormKey as PageCacheFormKey;

          use MagentoFrameworkSessionConfigConfigInterface;

          use MagentoFrameworkStdlibCookieCookieMetadataFactory;



           public function refreshFormKey()

          $beforeWishlistRequest = $this->_customerSession->getBeforeWishlistRequest();


          if ($beforeWishlistRequest !== null)

          $formKeyData = ObjectManager::getInstance()->get(FormKey::class);

          //form_key is already empty
          $formKey = $formKeyData->getFormKey();

          $sessionConfig = ObjectManager::getInstance()->get(ConfigInterface::class);
          $cookieMetadata = ObjectManager::getInstance()->get(CookieMetadataFactory::class)->createPublicCookieMetadata();
          $cookieMetadata->setDomain($sessionConfig->getCookieDomain());
          $cookieMetadata->setPath($sessionConfig->getCookiePath());
          $cookieMetadata->setDuration($sessionConfig->getCookieLifetime());

          ObjectManager::getInstance()->get(PageCacheFormKey::class)->set(
          $formKey,
          $cookieMetadata
          );

          $beforeWishlistRequest['form_key'] = $formKey;
          $this->_customerSession->setBeforeWishlistRequest($beforeWishlistRequest);
          $this->_customerSession->setBeforeRequestParams($beforeWishlistRequest);
          $this->_customerSession->setBeforeModuleName('wishlist');
          $this->_customerSession->setBeforeControllerName('index');
          $this->_customerSession->setBeforeAction('add');


          return $this;



          2. vendormagentomodule-wishlistObserverCustomerLogin.php




          public function execute(Observer $observer)

          $this->wishlistData->refreshFormKey(); // add this line only
          $this->wishlistData->calculate();







          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%2f270336%2fmagento-2-wishlist-product-add-not-working-when-user-should-in-before-login%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














            Generate new FormKey and replace for oldRequestParams Wishlist




            1. vendormagentomodule-wishlistHelperData.php

              just added below code in this file...

            use MagentoFrameworkAppObjectManager;

            use MagentoFrameworkDataFormFormKey;

            use MagentoFrameworkAppPageCacheFormKey as PageCacheFormKey;

            use MagentoFrameworkSessionConfigConfigInterface;

            use MagentoFrameworkStdlibCookieCookieMetadataFactory;



             public function refreshFormKey()

            $beforeWishlistRequest = $this->_customerSession->getBeforeWishlistRequest();


            if ($beforeWishlistRequest !== null)

            $formKeyData = ObjectManager::getInstance()->get(FormKey::class);

            //form_key is already empty
            $formKey = $formKeyData->getFormKey();

            $sessionConfig = ObjectManager::getInstance()->get(ConfigInterface::class);
            $cookieMetadata = ObjectManager::getInstance()->get(CookieMetadataFactory::class)->createPublicCookieMetadata();
            $cookieMetadata->setDomain($sessionConfig->getCookieDomain());
            $cookieMetadata->setPath($sessionConfig->getCookiePath());
            $cookieMetadata->setDuration($sessionConfig->getCookieLifetime());

            ObjectManager::getInstance()->get(PageCacheFormKey::class)->set(
            $formKey,
            $cookieMetadata
            );

            $beforeWishlistRequest['form_key'] = $formKey;
            $this->_customerSession->setBeforeWishlistRequest($beforeWishlistRequest);
            $this->_customerSession->setBeforeRequestParams($beforeWishlistRequest);
            $this->_customerSession->setBeforeModuleName('wishlist');
            $this->_customerSession->setBeforeControllerName('index');
            $this->_customerSession->setBeforeAction('add');


            return $this;



            2. vendormagentomodule-wishlistObserverCustomerLogin.php




            public function execute(Observer $observer)

            $this->wishlistData->refreshFormKey(); // add this line only
            $this->wishlistData->calculate();







            share|improve this answer





























              0














              Generate new FormKey and replace for oldRequestParams Wishlist




              1. vendormagentomodule-wishlistHelperData.php

                just added below code in this file...

              use MagentoFrameworkAppObjectManager;

              use MagentoFrameworkDataFormFormKey;

              use MagentoFrameworkAppPageCacheFormKey as PageCacheFormKey;

              use MagentoFrameworkSessionConfigConfigInterface;

              use MagentoFrameworkStdlibCookieCookieMetadataFactory;



               public function refreshFormKey()

              $beforeWishlistRequest = $this->_customerSession->getBeforeWishlistRequest();


              if ($beforeWishlistRequest !== null)

              $formKeyData = ObjectManager::getInstance()->get(FormKey::class);

              //form_key is already empty
              $formKey = $formKeyData->getFormKey();

              $sessionConfig = ObjectManager::getInstance()->get(ConfigInterface::class);
              $cookieMetadata = ObjectManager::getInstance()->get(CookieMetadataFactory::class)->createPublicCookieMetadata();
              $cookieMetadata->setDomain($sessionConfig->getCookieDomain());
              $cookieMetadata->setPath($sessionConfig->getCookiePath());
              $cookieMetadata->setDuration($sessionConfig->getCookieLifetime());

              ObjectManager::getInstance()->get(PageCacheFormKey::class)->set(
              $formKey,
              $cookieMetadata
              );

              $beforeWishlistRequest['form_key'] = $formKey;
              $this->_customerSession->setBeforeWishlistRequest($beforeWishlistRequest);
              $this->_customerSession->setBeforeRequestParams($beforeWishlistRequest);
              $this->_customerSession->setBeforeModuleName('wishlist');
              $this->_customerSession->setBeforeControllerName('index');
              $this->_customerSession->setBeforeAction('add');


              return $this;



              2. vendormagentomodule-wishlistObserverCustomerLogin.php




              public function execute(Observer $observer)

              $this->wishlistData->refreshFormKey(); // add this line only
              $this->wishlistData->calculate();







              share|improve this answer



























                0












                0








                0







                Generate new FormKey and replace for oldRequestParams Wishlist




                1. vendormagentomodule-wishlistHelperData.php

                  just added below code in this file...

                use MagentoFrameworkAppObjectManager;

                use MagentoFrameworkDataFormFormKey;

                use MagentoFrameworkAppPageCacheFormKey as PageCacheFormKey;

                use MagentoFrameworkSessionConfigConfigInterface;

                use MagentoFrameworkStdlibCookieCookieMetadataFactory;



                 public function refreshFormKey()

                $beforeWishlistRequest = $this->_customerSession->getBeforeWishlistRequest();


                if ($beforeWishlistRequest !== null)

                $formKeyData = ObjectManager::getInstance()->get(FormKey::class);

                //form_key is already empty
                $formKey = $formKeyData->getFormKey();

                $sessionConfig = ObjectManager::getInstance()->get(ConfigInterface::class);
                $cookieMetadata = ObjectManager::getInstance()->get(CookieMetadataFactory::class)->createPublicCookieMetadata();
                $cookieMetadata->setDomain($sessionConfig->getCookieDomain());
                $cookieMetadata->setPath($sessionConfig->getCookiePath());
                $cookieMetadata->setDuration($sessionConfig->getCookieLifetime());

                ObjectManager::getInstance()->get(PageCacheFormKey::class)->set(
                $formKey,
                $cookieMetadata
                );

                $beforeWishlistRequest['form_key'] = $formKey;
                $this->_customerSession->setBeforeWishlistRequest($beforeWishlistRequest);
                $this->_customerSession->setBeforeRequestParams($beforeWishlistRequest);
                $this->_customerSession->setBeforeModuleName('wishlist');
                $this->_customerSession->setBeforeControllerName('index');
                $this->_customerSession->setBeforeAction('add');


                return $this;



                2. vendormagentomodule-wishlistObserverCustomerLogin.php




                public function execute(Observer $observer)

                $this->wishlistData->refreshFormKey(); // add this line only
                $this->wishlistData->calculate();







                share|improve this answer















                Generate new FormKey and replace for oldRequestParams Wishlist




                1. vendormagentomodule-wishlistHelperData.php

                  just added below code in this file...

                use MagentoFrameworkAppObjectManager;

                use MagentoFrameworkDataFormFormKey;

                use MagentoFrameworkAppPageCacheFormKey as PageCacheFormKey;

                use MagentoFrameworkSessionConfigConfigInterface;

                use MagentoFrameworkStdlibCookieCookieMetadataFactory;



                 public function refreshFormKey()

                $beforeWishlistRequest = $this->_customerSession->getBeforeWishlistRequest();


                if ($beforeWishlistRequest !== null)

                $formKeyData = ObjectManager::getInstance()->get(FormKey::class);

                //form_key is already empty
                $formKey = $formKeyData->getFormKey();

                $sessionConfig = ObjectManager::getInstance()->get(ConfigInterface::class);
                $cookieMetadata = ObjectManager::getInstance()->get(CookieMetadataFactory::class)->createPublicCookieMetadata();
                $cookieMetadata->setDomain($sessionConfig->getCookieDomain());
                $cookieMetadata->setPath($sessionConfig->getCookiePath());
                $cookieMetadata->setDuration($sessionConfig->getCookieLifetime());

                ObjectManager::getInstance()->get(PageCacheFormKey::class)->set(
                $formKey,
                $cookieMetadata
                );

                $beforeWishlistRequest['form_key'] = $formKey;
                $this->_customerSession->setBeforeWishlistRequest($beforeWishlistRequest);
                $this->_customerSession->setBeforeRequestParams($beforeWishlistRequest);
                $this->_customerSession->setBeforeModuleName('wishlist');
                $this->_customerSession->setBeforeControllerName('index');
                $this->_customerSession->setBeforeAction('add');


                return $this;



                2. vendormagentomodule-wishlistObserverCustomerLogin.php




                public function execute(Observer $observer)

                $this->wishlistData->refreshFormKey(); // add this line only
                $this->wishlistData->calculate();








                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 2 days ago

























                answered 2 days ago









                Bablu BarmanBablu Barman

                214




                214



























                    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%2f270336%2fmagento-2-wishlist-product-add-not-working-when-user-should-in-before-login%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

                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                    Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                    Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?