WPIntell

Source evidence

Need Wishlist Counter In Top Menu

Wishlist for WooCommerce · support · 2020-08-28T11:01:00+00:00

mixedsentiment
lowseverity
0.62relevance
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
Ranjeet Singh resolved
Hello, Joris. Hope you are doing well, Could you please let me know how I’ll make an ajax wishlist counter on the website top menu. I don’t know the core codding as much, Could you explain step by step, please. Thanks Ranjeet Singh The page I need help with: [ log in to see the link] Hello Anjeet, I presume you mean a counter that updates when you add an new item or remove an item from the wishlist? The videfasions.in website has a textwidget in the header. Currently this can not be done with a widget or shortcode. Only by modifiying the the or a child theme. In a theme I am using I have this php code to show the counter icon: <?php $wishListUrl = ''; if(function_exists('jvm_get_wishlist_url')){ $wishListUrl = jvm_get_wishlist_url(); } ?> <a href="<?php echo $wishListUrl;?>" class="wish-list-icon"> <img src="<?php echo get_stylesheet_directory_uri();?>/assets/images/heart.gif"> <?php if(function_exists('jvm_woocommerce_wishlist_get_count')) { $count = jvm_woocommerce_wishlist_get_count(); $class = $count == 0 ? ' hidden' : ''; ?> <span class="count<?php echo $class;?>"><?php echo $count;?></span> <?php } ?> </a> In javascript I have a small piece of code to update the counter: jQuery(function($) { $(document).on("beforeupdate.JVMWooCommerceWishlist", function(e) { // Update some the wishlist counter var $counter = $('.wish-list-icon .count'); if (e.wishlist.length > 0) { $counter.removeClass('hidden'); }else { $counter.addClass('hidden'); } $counter.html(e.wishlist.length); }); }); I hope this helps you. Kind regards, Joris Hello, Joris. Thanks for your support, I appreciate you for giving me your valuable time! Kind Regards Ranjeet Singh

Comments

2 shown
Joris van Montfort 2020-08-31T07:33:00+00:00

Hello Anjeet, I presume you mean a counter that updates when you add an new item or remove an item from the wishlist? The videfasions.in website has a textwidget in the header. Currently this can not be done with a widget or shortcode. Only by modifiying the the or a child theme. In a theme I am using I have this php code to show the counter icon: <?php $wishListUrl = ''; if(function_exists('jvm_get_wishlist_url')){ $wishListUrl = jvm_get_wishlist_url(); } ?> <a href="<?php echo $wishListUrl;?>" class="wish-list-icon"> <img src="<?php echo get_stylesheet_directory_uri();?>/assets/images/heart.gif"> <?php if(function_exists('jvm_woocommerce_wishlist_get_count')) { $count = jvm_woocommerce_wishlist_get_count(); $class = $count == 0 ? ' hidden' : ''; ?> <span class="count<?php echo $class;?>"><?php echo $count;?></span> <?php } ?> </a> In javascript I have a small piece of code to update the counter: jQuery(function($) { $(document).on("beforeupdate.JVMWooCommerceWishlist", function(e) { // Update some the wishlist counter var $counter = $('.wish-list-icon .count'); if (e.wishlist.length > 0) { $counter.removeClass('hidden'); }else { $counter.addClass('hidden'); } $counter.html(e.wishlist.length); }); }); I hope this helps you. Kind regards, Joris

Ranjeet Singh 2020-08-31T11:04:00+00:00

Hello, Joris. Thanks for your support, I appreciate you for giving me your valuable time! Kind Regards Ranjeet Singh