WordPress.org

Forums

WooCommerce - excelling eCommerce
[resolved] Action hook on removing product from cart (4 posts)

  1. Lukasz Nowicki
    Member
    Posted 1 year ago #

    Hello there!

    I found woocommerce_add_to_cart hook and it very useful, but I need similar hook which triggers before/after removing item from cart - I need ID of the product.
    Is this possible?
    Thank you in advance.

    https://wordpress.org/plugins/woocommerce/

  2. seforoth
    Member
    Posted 1 year ago #

    Hi Lukasz,

    I'm facing the same issue and was wondering if you managed to find an answer?

    Thank you very much.

  3. Lukasz Nowicki
    Member
    Posted 1 year ago #

    Hi Seforoth!
    Unfortunately, I did not.
    I will try to manage with sessions, can't see any other way.
    cheers!
    Luke

  4. alfiebesin
    Member
    Posted 6 months ago #

    Hi Lukasz,

    I know this was posted 6 months ago, but might be helpful for those who will encounter the same issue in the future.

    You can use woocommerce_before_cart_item_quantity_zero filter for this one.

    /**
     * WooCommerce Cart item quantity was set to 0
     */
    add_filter('woocommerce_before_cart_item_quantity_zero', 'wordpress_before_cart_item_quantity_zero', 10, 1);
    function wordpress_before_cart_item_quantity_zero($cart_item_key)
    {
        write_log('Cart quantity updated to zero. Cart item key: ' . $cart_item_key);
    }

    Cheers,
    Alfie

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic