Add to Cart button not working on mobile device

Solved
imjeng
New Member
5 0 0

I used booster theme. while add to cart is not working on mobile device while it works fine in browser. Additional, when i click buy it now button it shows transaction failed error. please help me out. 

0 Likes
Pallavi
Shopify Expert
703 89 100

Hello There, 

 

Could you kindly share your store URL so that I can take a look and suggest you some solution on it. 

 

Want to modify or develop new app, Hire us.
If helpful then please Like and Accept Solution .
Email: support@zestard.com
Shopify Apps URL :- https://apps.shopify.com/partners/zestard-technologies
Custom Modifications Into Shopify Theme | Shopify Private App | SEO & Digital Marketing
0 Likes
imjeng
New Member
5 0 0

url: b4bicycles.com

password: b4bicycles

please help me , note: buy it now button is not working in mobile devices

0 Likes
Pallavi
Shopify Expert
703 89 100

Hello There, 

 

I have checked your store and found that in the mobile view the structure of the button is different what it is in the desktop view. So, the add.js event is not triggered on it. So, you will need to make the structure to match the desktop view so that it will work fine. 

 

If you want me to assist you further on it then kindly DM me so that we can proceed further on it and make it work.

Want to modify or develop new app, Hire us.
If helpful then please Like and Accept Solution .
Email: support@zestard.com
Shopify Apps URL :- https://apps.shopify.com/partners/zestard-technologies
Custom Modifications Into Shopify Theme | Shopify Private App | SEO & Digital Marketing
0 Likes

This is an accepted solution.

@imjeng 

1. In your Shopify Admin go to online store > themes > actions > edit code
2. In your theme.liquid file, find the </body> (press CTRL + F or command + F on Mac)
3. paste this code right above the </body> tag:

<script>
    function addToCartMobileClick() {

if (!/product/.test(window.location.href)){
return;
}

        var btn = document.querySelector(`#mst-stiky-box button`);

btn.addEventListener('click', function(){
var atc = document.querySelector(`.grid__item.row_grid_qnt button`);

atc.click();
});
    }

addToCartMobileClick()
</script>




Please let me know whether it works.

Kind regards,
Diego

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Using a free theme? Improve it with copy/paste code snippets clicking here.
◦ Looking to hire an experienced developer? Same day response: ezfycode@gmail.com.
imjeng
New Member
5 0 0

thanks, its working. but when i changed to dynamic button then it shows transaction error.

0 Likes
Jdp2009
Tourist
7 0 1

Hello

I have a similar problem with the buy button. I can add items to cart but it never proceeds to checkout to take payments.. please help. Ive been stuck on this for weeks and i already paid my plan

 

-joliz

0 Likes