Add Wishlist counter [yith] JS
Goals:
You can create wishlist counter on your e-commerce website (especially on our theme).
Requirement:
Install plugin YITH WooCommerce Wishlist
Tutorial:
After you already install the plugin, you can adjust the settings in the plugin as needed. you can see an example below:





after that, we will create a shortcode, open your theme on vs code then you can go to your_thems > includes, you can add new folder like the picture below:

Here the code class-WishlistIcon.php, you can copy:
Here the code template-item-count.php, you can copy:
Here the code autoload.php, you can copy:
You can add your shortcode on your website [yith_wcwl_items_count]


You can add code for style on folder scss, you can see image below:

here the code wishlist.scss, for styling the icon heart:
Don't forget to update your plugin.scss, add this code:
Notes: for styling you can change it according to the color of your website.
here the reference link: https://support.yithemes.com/hc/en-us/articles/115001372967-Wishlist-How-to-count-number-of-products-wishlist-in-ajax
Good Luck.
Last updated