function getRecentlyViewedProducts() { var viewedProducts = []; var cookie = Cookies.get('recently_viewed_products'); if (cookie) { viewedProducts = JSON.parse(cookie); } return viewedProducts; } function addRecentlyViewedProduct(productId) { var viewedProducts = getRecentlyViewedProducts(); var index = viewedProducts.indexOf(productId); if (index > -1) { viewedProducts.splice(index, 1); } viewedProducts.unshift(productId); Cookies.set('recently_viewed_products', JSON.stringify(viewedProducts), { expires: 30, path: '/' }); }
top of page

Quality Gear

bottom of page