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

                    Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

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

                    Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form