New Shopify Certification now available: Liquid Storefronts for Theme Developers

Dawn: Bug while adding to Cart while on the Cart Page

Solved
herastore
Excursionist
19 0 1

So, I'm in Dawn version 11.0

In the Cart page, below the Total Price, I have a few items that users can see and click "Add to Cart".

If you do that, the cart pop up will appear as usual, asking if you want to "View Cart" or "Checkout".

 

The thing is, if you close the pop up  (because you are already in the cart page), the Total Price won't update at all. Users will be misguided, they have more items in the cart and think the price is updated, but it's not.

This seems like a bug, can someone check?

Accepted Solution (1)
Made4uo-Ribe
Shopify Partner
4235 978 1190

This is an accepted solution.

Hi @herastore 

 

BTW, I added the solution in the github request here

 

  • From your Shopify admin dashboard, click on "Online Store" and then "Themes".
  • Find the theme that you want to edit and click on "Actions" and then "Edit code".
  • In the "Assets" folder, click on "cart.js" file, add the code below under the updateCart(), before the closing bracket. Refer to image below
    if (document.querySelector('#main-cart-footer')) {
      fetch(`${routes.cart_url}`)
        .then((response) => response.text())
        .then((responseText) => {
          const html = new DOMParser().parseFromString(responseText, 'text/html');
          const sourceFooter = html.querySelector('#main-cart-footer');
          document.querySelector('#main-cart-footer').innerHTML = sourceFooter.innerHTML;
        })
        .catch((e) => {
          console.error(e);
        });
    }

 

Make sure to SAVE

Made4uoRibe_0-1699026376427.png

 

Please don't forget to 

Like

 and 

Mark Solution 

to the post that helped you. Thanks!
Sip, savor, and support – your

Coffee Tip

 helps us keep coding magic.❤️❤️❤️
Need a knowledgeable developer? Come and visit us at

Made4uo.com


View solution in original post

Replies 3 (3)
Made4uo-Ribe
Shopify Partner
4235 978 1190

Hi @herastore 

 

You are right! It is a bug. It seems like the Dawn developers forgot to update the totalPrice as well. It needs to connect to the updateCart function. I submitted the new issue for you in github.

Please don't forget to 

Like

 and 

Mark Solution 

to the post that helped you. Thanks!
Sip, savor, and support – your

Coffee Tip

 helps us keep coding magic.❤️❤️❤️
Need a knowledgeable developer? Come and visit us at

Made4uo.com


Made4uo-Ribe
Shopify Partner
4235 978 1190

This is an accepted solution.

Hi @herastore 

 

BTW, I added the solution in the github request here

 

  • From your Shopify admin dashboard, click on "Online Store" and then "Themes".
  • Find the theme that you want to edit and click on "Actions" and then "Edit code".
  • In the "Assets" folder, click on "cart.js" file, add the code below under the updateCart(), before the closing bracket. Refer to image below
    if (document.querySelector('#main-cart-footer')) {
      fetch(`${routes.cart_url}`)
        .then((response) => response.text())
        .then((responseText) => {
          const html = new DOMParser().parseFromString(responseText, 'text/html');
          const sourceFooter = html.querySelector('#main-cart-footer');
          document.querySelector('#main-cart-footer').innerHTML = sourceFooter.innerHTML;
        })
        .catch((e) => {
          console.error(e);
        });
    }

 

Make sure to SAVE

Made4uoRibe_0-1699026376427.png

 

Please don't forget to 

Like

 and 

Mark Solution 

to the post that helped you. Thanks!
Sip, savor, and support – your

Coffee Tip

 helps us keep coding magic.❤️❤️❤️
Need a knowledgeable developer? Come and visit us at

Made4uo.com


herastore
Excursionist
19 0 1

Nice! Thanks a lot!