Add to Cart button non responsive on homepage.

Solved

Add to Cart button non responsive on homepage.

TimEasy
Visitor
2 1 3

Hi all, when clicking the add to cart button the homepage, I get no response.

If I then refresh the page, the items are showing in the cart. 

 

I can't seem to find any fix. Any ideas would be much appreciated.

https://synxsound.com/

Accepted Solution (1)
TimEasy
Visitor
2 1 3

This is an accepted solution.

Hi all,

Thank you for your help.

 

When clicking the add to cart button, this error appears:

 

product-form.js:99 TypeError: Cannot read properties of null (reading 'classList')
at HTMLElement.fetchQuantityRules (product-info.js:61:69)
at pubsub.js:20:7
at Array.forEach (<anonymous>)
at publish (pubsub.js:19:28)
at product-form.js:76:15

 

I told ChatGPT my problem and it gave me the following response:

Screenshot 2025-03-09 at 7.22.31 AM.png

I followed instruction and now the issue is resolved.

View solution in original post

Replies 4 (4)

TheUntechnickle
Shopify Partner
540 65 158

Hey @TimEasy.

Hope you're doing great!

I dug deep into your store and found when the ATC button is clicked on homepage, it throws an error in the console relating to product-form.js. We'll need to fix that in order to make the ATC work. Attached the screenshot of the error:

TheUntechnickle_0-1741430952036.png

 

We'd love to fix this for you, for free. Please DM or email your collaborator code and we'll try to fix it.

Thanks,
Shubham | Untechnickle

Helping for free: hello@untechnickle.com


Don't forget to say thanks, it'll make my day - just send me an email! 


Get Revize for Free | Let your shoppers edit orders post-purchase | Get Zero Support Tickets | #1 Order Editing + Upsell App

goldi07
Navigator
381 41 67

Hello @TimEasy 

This issue usually happens because of JavaScript conflicts, theme customizations, or Shopify's cart AJAX functionality not working correctly. Here’s what you can try to fix it:

Troubleshooting Steps
1.Check the Console for Errors

. Open the homepage.
. Right-click > Inspect > Console (or press F12 > Console tab).
. Look for any errors in red. If you see any, share them here.

2.Test in a Fresh Theme

. Try enabling a Shopify default theme (like Dawn) and see if the issue persists. If the issue is gone, it's likely a theme customization causing it.
3.Force a Cart Update After Adding

. Add this JavaScript snippet inside theme.liquid before </body>:

document.addEventListener("DOMContentLoaded", function () {
    document.querySelectorAll('.product-form button[type="submit"]').forEach(button => {
        button.addEventListener('click', function () {
            setTimeout(() => {
                fetch('/cart.js').then(response => response.json()).then(data => {
                    document.dispatchEvent(new Event('cart:updated'));
                });
            }, 1000);
        });
    });
});

.This forces a cart update after adding an item.
4.Check theme.js or cart.js

Some themes use cart.js for AJAX cart updates. Look for fetch('/cart/add.js') or similar and ensure it’s properly handling responses.
5.Disable App Conflicts

.If you've recently installed any apps, disable them one by one and test again.

 

Thank you 😊

Was I helpful?

Buy me a coffee


APPS BY US :

Professional Customer Accounts APP


Want to modify or custom changes or bug fix on store . Or Need help with your store? Or -Want Complete Storefront
Email me -Goldi184507@gmail.com - Skype: live:.cid.819bad8ddb52736c -Whatsapp: +919317950519
Checkout Some Free Sections Here
TimEasy
Visitor
2 1 3

This is an accepted solution.

Hi all,

Thank you for your help.

 

When clicking the add to cart button, this error appears:

 

product-form.js:99 TypeError: Cannot read properties of null (reading 'classList')
at HTMLElement.fetchQuantityRules (product-info.js:61:69)
at pubsub.js:20:7
at Array.forEach (<anonymous>)
at publish (pubsub.js:19:28)
at product-form.js:76:15

 

I told ChatGPT my problem and it gave me the following response:

Screenshot 2025-03-09 at 7.22.31 AM.png

I followed instruction and now the issue is resolved.

goldi07
Navigator
381 41 67

ok great 😊

Was I helpful?

Buy me a coffee


APPS BY US :

Professional Customer Accounts APP


Want to modify or custom changes or bug fix on store . Or Need help with your store? Or -Want Complete Storefront
Email me -Goldi184507@gmail.com - Skype: live:.cid.819bad8ddb52736c -Whatsapp: +919317950519
Checkout Some Free Sections Here