How to redirect ADD TO CART button to CART DRAWER ON NARRATIVE THEME

Esteban19
Excursionist
34 0 5

Hi there, I need help to fix this on a NARRATIVE THEME:

 

I add this js code in an asset file to make redirect the add to cart button to cart drawer (not cart page) after 3.5 seconds before is click the button. It works but it has a bug that makes the product add to the cart unlimited times, and open to the cart drawer as well unlimited times. 

 

$(document).ready(function() {
  // Open cart drawer after add to cart button is clicked
  $('.product__add-to-cart-button').on('click', function(){
    setTimeout(function(){ $('.ajax-cart__toggle').click() }, 3500);
  });
});

I'll appreciate any help!!

0 Likes
DZwimmer
Tourist
4 0 1

bump

0 Likes
Boxo90
Tourist
6 0 2

Hi @Esteban19 the narrative theme is not easy to add new functionalities, especially with custom js, also this theme uses a compression version of it jquery and js to work, so then it a quite tricky to make this, you will have to redo that code. And make more changes

0 Likes
djskwat
Excursionist
17 0 7

Hi,

I'm looking for the same thing.

Did you find any solution?

 

Boxo90
Tourist
6 0 2

Hello everyone! I find the solution @djskwat 

 

0 Likes
Boxo90
Tourist
6 0 2

Redirect to cart.gif

Anyone who is interested, just send me a PM

djskwat
Excursionist
17 0 7

Hi, 

Thank you for helping. How were you able to do this?


@Boxo90 wrote:

Redirect to cart.gif

Anyone who is interested, just send me a PM


 

 
0 Likes
Boxo90
Tourist
6 0 2
Not easy at all! You have to modify the Js code from the actual add to cart button, replace it on theme.js file replace the theme.min.js for the code you add in the theme.js in order to that the narrative theme works properly because as you cna see it use minifed version to work, an then create a new functional js file in assets to work prooerly whitout bugs.
If you need help I can help you to achieve this :)
0 Likes
djskwat
Excursionist
17 0 7

Oh yeah I would need some help to do this

0 Likes
djskwat
Excursionist
17 0 7

Hi, 

Could you help me on that


@Boxo90 wrote:
Not easy at all! You have to modify the Js code from the actual add to cart button, replace it on theme.js file replace the theme.min.js for the code you add in the theme.js in order to that the narrative theme works properly because as you cna see it use minifed version to work, an then create a new functional js file in assets to work prooerly whitout bugs.
If you need help I can help you to achieve this :)


?

0 Likes