I have succeed implement this code to remove product from cart with Ajax. But it didn't works with Variable Product.
/**
* Remove Cart via Ajax
*/
function product_remove() {
global $wpdb, $woocommerce;
session_start();
$cart = WC()->instance()->cart;
$id = $_POST['product_id'];
$cart_id = $cart->generate_cart_id($id);
$cart_item_id = $cart->find_product_in_cart($cart_id);
if($cart_item_id){
$cart->set_quantity($cart_item_id,0);
}
}
add_action( 'wp_ajax_product_remove', 'product_remove' );
add_action( 'wp_ajax_nopriv_product_remove', 'product_remove' );
Maybe i need to pass $variation_id to $cart_id but i dont know how to do it.