I add a popup login form in my magento 2 template and when I add a product to the wishlist and I'm not logged in, I want to show the popup for the login and then add to wishlist the product.

Anyone knows how to do it?


1 Answer 1


You can use code:

  1. code html:

you can looking at vendor/magento/module-customer/view/frontend/templates/form/login.phtml

  1. add in your layout

    <referenceContainer name="before.body.end">
        <block class="\Magento\Customer\Block\Form\Login" name="mlx_guestwishlist2_js" template="Magento_Customer::form/login.phtml"/>
  2. add styles

.block-customer-login{display: none;}

  1. add js


  • Hello, As I am using magento 2 can you please elaborate that in which file we need to make changes or shall we create a different module to open pop-up on wish list button.
    – Tush
    Jan 12, 2017 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.