Dawn theme update cart-drawer after adding product throught add.js

Azis
Tourist
5 0 2

As mentioned in the title I want to update the cart-drawer without refreshing the page just like the normal add does but I'm doing it with the add.js using this lines of code, how can I update the cart drawer? (stock dawn theme, no modifications):

 

const response = await fetch(window.Shopify.routes.root + 'cart/add.js', {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
          },
          body: JSON.stringify(products),
        });
      }

 

  

Replies 3 (3)

Azis
Tourist
5 0 2

bump

styleshop27
Shopify Partner
30 0 2

Did you ever find a solution to this?

Azis
Tourist
5 0 2

I never found the solution, I switched the approach since this one didn't work.