loadCSS isn't working

As mentioned here in the documentation, some settings can be added or modified inside the window.SnipcartSettings object.

Found on loadCSS:

Setting the loadCSS option to false will omit loding the CSS assets for Snipcart.

It looks like this setting isn’t working nor interacting at all with the default installation script which I copied from very first installation instruction, as the external snipcart.css file from Snipcart is still being loaded.

Below a copy of the installation instruction + HTML code snippet. Please check the very last (long) line-item before the closing </script> tag in the HTML code snippet where the loadCSS option is missing completely.

To install Snipcart on your website, copy the following HTML code snippet and paste it directly into your website’s markup. As a best practice, we recommend you add it directly after the <body> element.

<script>
  window.SnipcartSettings = {
    publicApiKey: "YOUR_API_KEY",
    loadStrategy: "on-user-interaction",
    loadCSS: false,
  };

  (()=>{var c,d;(d=(c=window.SnipcartSettings).version)!=null||(c.version="3.0");var s,S;(S=(s=window.SnipcartSettings).timeoutDuration)!=null||(s.timeoutDuration=2750);var l,p;(p=(l=window.SnipcartSettings).domain)!=null||(l.domain="cdn.snipcart.com");var w,u;(u=(w=window.SnipcartSettings).protocol)!=null||(w.protocol="https");var f=window.SnipcartSettings.version.includes("v3.0.0-ci")||window.SnipcartSettings.version!="3.0"&&window.SnipcartSettings.version.localeCompare("3.4.0",void 0,{numeric:!0,sensitivity:"base"})===-1,m=["focus","mouseover","touchmove","scroll","keydown"];window.LoadSnipcart=o;document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r):r();function r(){window.SnipcartSettings.loadStrategy?window.SnipcartSettings.loadStrategy==="on-user-interaction"&&(m.forEach(t=>document.addEventListener(t,o)),setTimeout(o,window.SnipcartSettings.timeoutDuration)):o()}var a=!1;function o(){if(a)return;a=!0;let t=document.getElementsByTagName("head")[0],e=document.querySelector("#snipcart"),i=document.querySelector(`src[src^="${window.SnipcartSettings.protocol}://${window.SnipcartSettings.domain}"][src$="snipcart.js"]`),n=document.querySelector(`link[href^="${window.SnipcartSettings.protocol}://${window.SnipcartSettings.domain}"][href$="snipcart.css"]`);e||(e=document.createElement("div"),e.id="snipcart",e.setAttribute("hidden","true"),document.body.appendChild(e)),v(e),i||(i=document.createElement("script"),i.src=`${window.SnipcartSettings.protocol}://${window.SnipcartSettings.domain}/themes/v${window.SnipcartSettings.version}/default/snipcart.js`,i.async=!0,t.appendChild(i)),n||(n=document.createElement("link"),n.rel="stylesheet",n.type="text/css",n.href=`${window.SnipcartSettings.protocol}://${window.SnipcartSettings.domain}/themes/v${window.SnipcartSettings.version}/default/snipcart.css`,t.prepend(n)),m.forEach(g=>document.removeEventListener(g,o))}function v(t){!f||(t.dataset.apiKey=window.SnipcartSettings.publicApiKey,window.SnipcartSettings.addProductBehavior&&(t.dataset.configAddProductBehavior=window.SnipcartSettings.addProductBehavior),window.SnipcartSettings.modalStyle&&(t.dataset.configModalStyle=window.SnipcartSettings.modalStyle),window.SnipcartSettings.currency&&(t.dataset.currency=window.SnipcartSettings.currency),window.SnipcartSettings.templatesUrl&&(t.dataset.templatesUrl=window.SnipcartSettings.templatesUrl))}})();
</script>

Maybe try using the version attribute and specifying a newer version. It does state here that it’s required when you have a customised cart.

Thank you @logix92 , I’ve included the version attribute and set it manually to the current latest version like this, but this doesn’t work unfortunately.

version: "3.4.1",

I expect that @snipcart needs to update the initialisation HTML snippet as the loadCSS variable is currently missing in the line right before the closing </script> tag.

Ah OK yeah this makes sense. Bit of an oversight from Snipcart, but it happens. Need them to update the script ASAP.

Hey @Paul @logix92,

The installation script as now been updated on the documentation with the latest adjustment for the loadCSS option.

Cheers!