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:

  1. After you already install the plugin, you can adjust the settings in the plugin as needed. you can see an example below:

  1. 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:

  1. You can add your shortcode on your website [yith_wcwl_items_count]

  1. 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