Conversation
supportHello, 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
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