Why does my buy button require two clicks?

Solved

Why does my buy button require two clicks?

Csbrnk
Tourist
4 0 1

Hi. On our webshop; www.bearlifestyle.nl you need to press the buy button twice since  a while.

I dont know why this is happening, also deleting your item from the pop up shopping cart gives a white screen sometimes.

Unfortunately our site developer is nog very cooperative so if somebody knows a quick fick it will be much appreciated 🙂

 

Accepted Solution (1)

tim
Shopify Partner
3765 351 1385

This is an accepted solution.

Double-tap is because of the Kaktus App -- do not know which one it is, but preventing Apps JS from loading in my browser fixes the double-tap problem.

 

As for the empty cart drawer -- I can't be 100% sure but i'd change the following in your assets/theme.js (some code is replaced with ... for brevity)

from

 

  async _changeLineItemQuantity(lineKey, targetQuantity) {
...
      const cartContent = await (await fetch(`${Shopify.routes.root}cart/change.js`, {
...
        body: JSON.stringify({
          id: lineKey,
          quantity: targetQuantity,
          sections: ["cart-drawer"]
        })

 

 

to

 

  async _changeLineItemQuantity(lineKey, targetQuantity) {
...
      const cartContent = await (await fetch(`${Shopify.routes.root}cart/change.js`, {
...
        body: JSON.stringify({
          id: lineKey,
          quantity: targetQuantity,
          sections: [extractSectionId(this)]
        })

 

Basically it's the sections: line which I see as line 2002 in your theme.js

 

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail [email protected]

View solution in original post

Replies 5 (5)
Csbrnk
Tourist
4 0 1

For me its not working, sometimes i even get this message and after a while and few clicks it works again.. Very strange

 

Scherm­afbeelding 2024-04-29 om 14.42.19.png

tim
Shopify Partner
3765 351 1385

This is an accepted solution.

Double-tap is because of the Kaktus App -- do not know which one it is, but preventing Apps JS from loading in my browser fixes the double-tap problem.

 

As for the empty cart drawer -- I can't be 100% sure but i'd change the following in your assets/theme.js (some code is replaced with ... for brevity)

from

 

  async _changeLineItemQuantity(lineKey, targetQuantity) {
...
      const cartContent = await (await fetch(`${Shopify.routes.root}cart/change.js`, {
...
        body: JSON.stringify({
          id: lineKey,
          quantity: targetQuantity,
          sections: ["cart-drawer"]
        })

 

 

to

 

  async _changeLineItemQuantity(lineKey, targetQuantity) {
...
      const cartContent = await (await fetch(`${Shopify.routes.root}cart/change.js`, {
...
        body: JSON.stringify({
          id: lineKey,
          quantity: targetQuantity,
          sections: [extractSectionId(this)]
        })

 

Basically it's the sections: line which I see as line 2002 in your theme.js

 

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail [email protected]
Csbrnk
Tourist
4 0 1

This fixed both the problems, thanks!!!

Madshollensen
Visitor
1 0 0

Is there a way I can search in theme.js for that specific code? I have the same issue with the double click on the "add to basket"

Our Webshop; www.gooshpads.dk seems to have the same problem unfortunately, and I cant find any videoes explaining why.

 

Kind regards

tim
Shopify Partner
3765 351 1385

You have an element created by this app https://apps.shopify.com/assortion which covers the cart button and is removed upon first click:

Screenshot 2024-05-29 at 4.00.37 pm.png

 

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail [email protected]