cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way to show a signin popup when a product is added to wishlist?

SOLVED

Is there any way to show a signin popup when a product is added to wishlist?

Hi All,

Iam using an extension to show my signin in a popup form. When I add an item to wishlist, iam redirected to login page instead login popup. I wanted user to load popup and login when an item is added to wishlist. Is there any way to do this? 

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Is there any way to show a signin popup when a product is added to wishlist?

@rekharajas68ab 
you can use the following code to check customer is logged in or not 

 

define([
    'uiComponent',
    'Magento_Customer/js/model/customer'
], function (
    Component,
    customer
) {
    'use strict';
    return Component.extend({},

        /**
         * Check if the customer is logged in or not
         * @return {boolean}
         */
        isLoggedIn: function () {
            return customer.isLoggedIn();
        }
    });
});

then you can update the onClick function for wishlist and show the popup for login if the customer is not logged in. 

 

I hope it helps!

View solution in original post

1 REPLY 1

Re: Is there any way to show a signin popup when a product is added to wishlist?

@rekharajas68ab 
you can use the following code to check customer is logged in or not 

 

define([
    'uiComponent',
    'Magento_Customer/js/model/customer'
], function (
    Component,
    customer
) {
    'use strict';
    return Component.extend({},

        /**
         * Check if the customer is logged in or not
         * @return {boolean}
         */
        isLoggedIn: function () {
            return customer.isLoggedIn();
        }
    });
});

then you can update the onClick function for wishlist and show the popup for login if the customer is not logged in. 

 

I hope it helps!