• Resolved adamskaat

    (@adamskaat)


    Hi

    We use this code

    jQuery(document.body) .on( ‘removed_from_cart updated_cart_totals’, function() { console.log(“removed”) } );

    This is working when the cart has other products and when one of them I remove it’s working correctly but when I remove the last it does not fire why?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @adamskaat

    Thanks for reaching out!

    I understand that you are using the code snippet above that is working when the cart has other products and when one of the products were removed, however, it is not firing when the last product was removed, correct?

    This is a bit of a complicated topic that would need some customization to address. Unfortunately, custom coding is not something we can assist with directly. However, I’ll keep this thread open for a bit to see if anyone from the community can lend a hand.

    If you have any other questions related to development or custom coding, don’t hesitate to reach out to some of the great resources we have available for support. The WooCommerce community is filled with talented open-source developers, and many of them are active on the channels listed below:

    Hope this helps!

    Thread Starter adamskaat

    (@adamskaat)

    Dear @xue28,

    Yes, that event works when there are other products but not working for the last one.

    We have a countdown and want to hide the countdown When cart is empty, so we need to a JS action to understand currently cart empty.

    Please provide a JS event name which can help us understand product item deleted from cart, just need to an action from you and we will implement it on our plugin.

    I’m looking forward from you to get a action which will help us via js understand there is a change in the cart, that can provide only your plugin.

    Our plugin is https://www.ads-software.com/plugins/countdown-builder/

    Please help us it’s urgent

    Thread Starter adamskaat

    (@adamskaat)

    Dear ?@xue28,

    Do you have a progress?

    Thread Starter adamskaat

    (@adamskaat)

    dear @xue28

    Do you have any update we are looking for to your reply.

    Hi @adamskaat

    Apologies for my late reply.

    As I mentioned above, custom coding is not something we can assist with directly as this is outside our scope of support.

    Please try to reach out to the links I suggested above for further assistance about customization.

    Thanks!

    Thread Starter adamskaat

    (@adamskaat)

    Dear @xue28,

    I dont want from your custom coding, on your plugin you have a js issue, it’s not working as you wrote, so that’s why here i ask you to help me.

    This forum for cases like this, so please give me solution.

    Saif

    (@babylon1999)

    Hello @adamskaat,

    I dont want from your custom coding, on your plugin you have a js issue, it’s not working as you wrote, so that’s why here i ask you to help me.

    We’d really love to help here but as I understand it, you’re using the JS snippet above to develop a custom snippet, this falls under customizations which I’m afraid is not within our scope of support as mentioned above.

    That said, I tried checking if there’s another method to achieve what you’re trying to do and landed on this:

    jQuery( document.body ).on( 'wc_cart_emptied', function()
    {
       console.log("Does this work?");
    } );

    Source: https://theme.co/forum/t/woocommerce-empty-cart-conditions/85000/4

    I’ve tested it on the cart page and can confirm it works. :?)

    Hope it helps!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘JS event remove product from the cart’ is closed to new replies.