Support » Plugin: JVM WooCommerce Wishlist » Login before adding to wishlist

  • Resolved thomasnet20

    (@thomasnet20)


    Hello Joris,

    Thanks for the great plugin. I wanted to see how I can get the user to login first when trying to add to wishlist. When the user clicks on the wishlist icon in the product category page, or product page, I’d like to open the login form and redirect back to the product category/product with the item added once login is successful.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Joris van Montfort

    (@jorisvanmontfort)

    Hi Thomas,

    Good to hear you like the plugin. Your plan sounds like a nice idea, but kind of out the scope of the plugin. The loginform and redirect are something you will need to sort yourself.

    Not tested but this would be a starting point:

    
    <?php if ( is_user_logged_in() ) { ?>
      <a class="account" href="<?php echo get_permalink(get_option('woocommerce_myaccount_page_id')); ?>">Login & add to wishlist</a>
    <?php } else { 
      jvm_woocommerce_add_to_wishlist
    } ?>  
    

    I’m not exactly sure how to make the redirect after login from Woo Commerce. You will need to sort that out yourself.

    Adding the product to the wishlist can be done with the jvm_woocommerce_add_to_wishlist() function. You can pass a product id as parameter.

    Not exactly a working solution but I hope it is a startingpoint.

    Kind regards, Joris

    Thread Starter thomasnet20

    (@thomasnet20)

    Hi Joris,

    Thanks for the suggestion. This would work fine. I am using ajax login so the page can be redirected once logged in and the wishlist function called for the product id using a simple get or post query. I suppose it’s best that this feature is not part of the plugin so that custom login processes can be integrated easily.

    Cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Login before adding to wishlist’ is closed to new replies.