shoppingcarticon only visible in preview mode


Above is Preview. shoppingcarticon and its function is working perfectly fine.


When Published the shoppingcarticon does not show up. This was working for last two months perfectly. No code change since.

Code

if (hasvarient){
let key = product.varientKey;
//console.log(‘has varient’, hasvarient + ’ : ’ + key);
let varient = $item(‘#productvarient’).value;
console.log(‘varient’, varient + “:” + productObj.productId);
$item(“#shoppingCartIcon1”).addToCart(productObj.productId, qty,{“choices”: {[key]: varient}})
.then(() => console.log(‘added with varient!’))
. catch (console.error);
}
Note: This code does not give any error in preview mode. My preview and live DB is exact mirror. I belive this is due to shoppingcart icon is not displaying on live mode. Please help - not sure why suddenly this icon does not showup on publish mode.
Error