WPIntell

Source evidence

Login before adding to wishlist

Wishlist for WooCommerce · support · 2020-07-26T11:06:00+00:00

mixedsentiment
lowseverity
0.68relevance
2replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

3 / 31 rows with source links

9.7% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

28 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
thomasnet20 resolved
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 This topic was modified 5 years, 10 months ago by thomasnet20 . 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 This reply was modified 5 years, 10 months ago by Joris van Montfort . This reply was modified 5 years, 10 months ago by Joris van Montfort . 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

Comments

2 shown
Joris van Montfort 2020-07-28T00:39:00+00:00

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 This reply was modified 5 years, 10 months ago by Joris van Montfort . This reply was modified 5 years, 10 months ago by Joris van Montfort .

thomasnet20 2020-08-06T15:42:00+00:00

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