🚨 Snipcart updated how the script is loaded. Here are the installation docs for more information.
I've also update the code in github to work with Snipcart's latest version.
We want to make sure that when we add something to the cart, we're going to be able to actually add it to our cart. I'm going to be using Snipcart to handle my cart and checkout flow.
We will also our cart update inside of our header with that dynamic value. To do that, we will sign up and install Snipcart where we add the installation to a custom document file and add our class name and data attributes to all of our Add to Cart buttons.
Lastly, we will install the useSnipcart hook so that we can grab that context to show that subtotal anywhere inside of our application.
Hi Colby, it seems the Snipcart Document has changed, which indicates we need to embed the script tag into the body tag only. I tried to embed that script tag within the custom _document.js file but it does not work. Can you help me with this?
Thanks for the heads up, missed this change
Can you try something like this?
<script dangerouslySetInnerHTML={{ __html: ` /* Snipcart script */ `, }} /><script
dangerouslySetInnerHTML={{
__html: `
/* Snipcart Script */
`,
}}
/>