Support » Plugin: YITH WooCommerce Wishlist » [BUG] Submission – Error on remove_from_wishlist_after_add_to_cart Hook

  • Resolved w00tw00t111

    (@w00tw00t111)


    Hello,

    The bug is when adding a product from your wishlist to your cart, removing it from your wishlist, and redirecting to the cart page.

    To replicate the problem:
    1. Install YITH WooCommerce Wishlist – version 2.1.2 and WooCommerce 3.1.0
    2. Set Redirect to cart – true
    3. Set Remove if added to the cart – true
    4. Login to customer account
    5. Add product to wishlist
    —-
    6. Add the following code to your theme’s functions file:
    add_action ( ‘woocommerce_after_cart_item_quantity_update’, ‘test’ );
    function test( $cart_item_key, $quantity, $old_quantity ){
    var_dump($quantity);
    var_dump($old_quantity);
    }
    7. Add product to cart
    —-
    Issue:
    After adding the product to your cart you’ll receive the following error:
    Warning: Missing argument 2 for test(), called in …[Insert your site’s specific details]

    Warning: Missing argument 3 for test(), called incalled in …[Insert your site’s specific details]

    Additional Information:
    The WooCommerce code for the woocommerce_after_cart_item_quantity_update hook can be found:
    https://github.com/woocommerce/woocommerce/blob/3522857d23051844bea742a37a1b0b242f7850af/includes/class-wc-cart.php#L1048

    From my investigation the offending YITH code seems to be:
    \yith-woocommerce-wishlist\includes\class.yith-wcwl.php line 115

    The code hooks into the WC woocommerce_add_to_cart and does not provide the proper variable values in the called function (remove_from_wishlist_after_add_to_cart).

    Server Environment:
    Apache
    PHP 7

    Thank you,

  • The topic ‘[BUG] Submission – Error on remove_from_wishlist_after_add_to_cart Hook’ is closed to new replies.