Wishlist Header Counter or fave counter

Created by Gopinath Nagalingam, Modified on Wed, 26 Jun at 9:46 AM by Gopinath Nagalingam

TABLE OF CONTENTS



Overview:


This solution aims to provide a method to add a header counter to the wishlist icon that can denote the number of items present in a user’s wishlist.


Prerequisites: 


The header should be enabled. Find the already existing swym wishlist header code for your theme (usually present in the header.liquid file) and check if it’s enabled. 


Note: If your site has not enabled the header launch point icon, you may follow this blog to enable the header icon and then follow this document. We also made a video to enable the header for your theme here.



Solution:


Part - I:  If your store uses the single wishlist feature


Step 1: Add the following code inside the <a> tag of the swym header code in the header.liquid


<span class="swym-wishlist-header-counter"></span>


The span tag should be placed inside the tag of the header icon, this would be incremented when products are added to the wishlist.



Step 2: Create a file swym-header-counter.liquid in your Snippets folder and paste the below script from the gist file.


Link: swym-wishlist counter. 


Step 3: Include the following CSS in your CSS file.


/*Wishlist header counter - content rendered after swym is ready to avoid showing block/invalid chars */
i.icon-swym-wishlist:after{  
visibility: hidden;
}
.swym-ready i.icon-swym-wishlist:after { 
 visibility: visible;  
 content: '\f004';
 }

Step 4: Include the file swym-header-counter in theme.liquid.


{%include 'swym-header-counter.liquid'%}


Part - II:  If your store uses the multiple wishlist feature

 

Kindly follow all the above steps except for Step-2. In step -2, please update the snippet file with the following script from the gist.


Link: Custom Script for enabling header counter for Multiple Lists Feature 



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article