• Resolved elisamarentette

    (@elisamarentette)


    I want after customer remove item from cart page, those items will automatically add to the wishlist.
    This is possible with your plugin? Or can you send any snippets for this feature.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi there

    please, try to add the following snippet of code at the end of functions.php file of your theme or child theme

    add_action( 'woocommerce_remove_cart_item', 'yith_wcwl_add_to_wishlist_after_removing_from_cart', 10, 2 );
    if ( ! function_exists( 'yith_wcwl_add_to_wishlist_after_removing_from_cart' ) ) {
    	function yith_wcwl_add_to_wishlist_after_removing_from_cart( $cart_item_key, $cart ) {
    		if ( ! defined( 'YITH_WCWL' ) ) {
    			return;
    		}
    
    		$product = $cart->cart_contents[ $cart_item_key ]['data'];
    
    		$wishlist = YITH_WCWL_Wishlist_Factory::get_default_wishlist();
    
    		if ( ! $wishlist ) {
    			return;
    		}
    
    		$wishlist->add_product( $product->get_id() );
    		$wishlist->save();
    	}
    }
    

    This should Add items to wishlist once product is removed from cart

    Thread Starter elisamarentette

    (@elisamarentette)

    Thanks, it’s working perfectly ??

    Plugin Support Antonio La Rocca

    (@therock130)

    You’re welcome

    We are doing our best to improve our plugins. Our target is to develop and release the best free plugins for WooCommerce, but to achieve this we need your help. Please leave a good review to support us and help our growth

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘After remove item from cart add item to Wishlist’ is closed to new replies.