We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Add to cart not working

Solved

Add to cart not working

Andy106
Pathfinder
117 7 33

Hello guys, I have this website store: https://mastorascy.myshopify.com/

When I am trying to 'add to cart', initially it works well, however, when I go and select a variant then suddenly the add to cart button becomes unclickable, whereas in the beginning before changing for a variant is working well. Any ideas why that is happening? Take this product for example: https://mastorascy.myshopify.com/products/garden-claw-gloves

Thanks in advance!

Accepted Solution (1)

Dan-From-Ryviu
Shopify Partner
12073 2359 2539

This is an accepted solution.

Hi @Andy106 

Did you add some customized code in global.js file? 

Please open this file, find and remove those lines of code and check again. 

if (source && destination) {
   destination.innerHTML = source.innerHTML;
   document.getElementById('my-price').innerHTML = source.innerHTML;
}

Screenshot 2024-12-27 at 08.42.42.png

 

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

View solution in original post

Replies 5 (5)

Dan-From-Ryviu
Shopify Partner
12073 2359 2539

This is an accepted solution.

Hi @Andy106 

Did you add some customized code in global.js file? 

Please open this file, find and remove those lines of code and check again. 

if (source && destination) {
   destination.innerHTML = source.innerHTML;
   document.getElementById('my-price').innerHTML = source.innerHTML;
}

Screenshot 2024-12-27 at 08.42.42.png

 

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

Andy106
Pathfinder
117 7 33

Hello, thanks for the reply. However, if I remove that part of the code, the problem is that the variants are not dynamic anymore, meaning that byc chaning the variant, then the price doesn't change and neither does the image which represents that variant.
Do you have any other suggestions?
Thanks:)

Dan-From-Ryviu
Shopify Partner
12073 2359 2539

Hi, I see it is working well on my side

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

Andy106
Pathfinder
117 7 33

Hello again!
Actually by you saying that I changed something in the global.js file you poked my memory and I remembered that I did change something there a very long time ago. 

I changed the code of ''innerHTML inside the price block ("destination" variable) to new price ("source" variable)'

with the following code "if (source && destination) { destination.innerHTML = source.innerHTML; document.getElementById('my-price').innerHTML = source.innerHTML; }",
when I was trying to create my own new price block, and I think this line "document.getElementById('my-price').innerHTML = source.innerHTML;" was messing up the whole add to acart button. I removed it now, and it works perfectly again. Thanks for helping me remember that change in the global.js file!

 

Dan-From-Ryviu
Shopify Partner
12073 2359 2539

Thanks for letting me know. 

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.