0

I want to obtain the event during which this Mini cart update cart button is clicked

enter image description here

I want to observe when and how many the amount of it being clicked

I try to put below code inside app/design/frontend/MageBig/martfury/myproject/Magento_Catalog/templates/gtm_body.phtml

require(['jquery'], function($){
    
    $(document).ready(function() {
        $('button.update-cart-item').click(function(e){
            e.preventDefault();
            alert("Clicked");
        })
    })

})

but it does not seems to work,

If I try putting directly into console in chrome browser it is working

Not sure how do I obtain this click event. Anyone can help give suggestions?

Any help is kindly appreciated, attached below is the inspect element tab view

enter image description here

4
  • 1
    do update click event is download after and minicart update button is add by knockout js, you try to call this type. $(document).on('click', 'button.update-cart-item', function(e){e.preventDefault();alert("Clicked");})
    – nhungo duc
    Commented Feb 17, 2022 at 10:00
  • have tried, not working Commented Feb 22, 2022 at 8:13
  • where is the knockout js that trigger this minicart sidebar open Commented Feb 22, 2022 at 8:14
  • file knockout js Magento_Customer/js/customer-data magento.stackexchange.com/questions/178125/…
    – nhungo duc
    Commented Feb 22, 2022 at 8:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.