Home Forums WoodMart support forum PureClarity Wishlist icon issues after the last theme update Reply To: PureClarity Wishlist icon issues after the last theme update

#419754

coveti
Participant

That is the JS code we use, it used to work with the old version of the theme.

<script type='text/javascript'>
    (function(id){
        let wishlistElements = document.getElementsByClassName('wd-tltp wd-tooltip-inited');
        for(var i = 0; i < (wishlistElements.length < 50 ? wishlistElements.length : 50); ++i){
            let el = wishlistElements[i];
            let key = el.getAttribute('data-key');
            if(key){
                let recElList = document.getElementsByClassName('pc-recommender-{{uniqueId}}');
                if(recElList && recElList.length > 0){
                    let recEl = recElList[0];
                    let recWishlist = recEl.querySelector('.wd-tltp.wd-tooltip-inited');
                    if(recWishlist && recWishlist.length > 0){
                        for(var j = 0; j < recWishlist.length; ++j){
                            recWishlist[j].setAttribute('data-key', key);
                        }
                    }
                }                
                break;
            }
        }
    })('.pc-recommender-{{uniqueId}}');

Please help us make the code compatible with the new version of the theme