Shopify themes, liquid, logos, and UX
Hi,
I made this shop for a customer not a long while ago, but now (maybe related to the apps he added) the add to cart button on the homepage is not working.
Can anyone help ?
Thank you in advance!
Solved! Go to the solution
This is an accepted solution.
Hey @Daniel19901,
The issue is regarding the missing spinner in the homepage. I can't figure out why because I don't have the backend, but I can give you a quick fix that should work theoretically.
Go to your theme's "Edit Code" option and look for "product-form.js"
Then look for the following that says
"this.querySelector('.loading__spinner').classList.remove('hidden');
Mine is line 27, but your's could be different.
Then replace that line with the following
try {
this.querySelector('.loading__spinner').classList.remove('hidden');
} catch(err) {
console.log('loading spinner unavailable.')
}
This is an accepted solution.
Hey @Daniel19901,
The issue is regarding the missing spinner in the homepage. I can't figure out why because I don't have the backend, but I can give you a quick fix that should work theoretically.
Go to your theme's "Edit Code" option and look for "product-form.js"
Then look for the following that says
"this.querySelector('.loading__spinner').classList.remove('hidden');
Mine is line 27, but your's could be different.
Then replace that line with the following
try {
this.querySelector('.loading__spinner').classList.remove('hidden');
} catch(err) {
console.log('loading spinner unavailable.')
}
I am developing an app for Shopify app store and I am getting the same error when adding the app block from my app to product page. I understand commenting out the spinner code will fix the issue (or putting it in try-catch), but I want to understand what is causing this issue? If my app code is not added, the issue doesn't happen. I can't ask all my merchants to modify this line of code. Any help is appreciated.
You could use your app to add the "loading__spinner" class into that element so that the error doesn't happen. Never comment out because in the event it works, it wouldn't do the proper function. That is why i put it in a try-catch block.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025