How to remove product from Woocommerce checkout page using Ajax
To remove a product from the WooCommerce checkout page using AJAX, you’ll need to add some custom code to your theme’s functions.php file. Here’s a step-by-step guide: add_action( ‘wp_ajax_remove_product_from_cart’, ‘remove_product_from_cart’ ); add_action( ‘wp_ajax_nopriv_remove_product_from_cart’, ‘remove_product_from_cart’ ); function remove_product_from_cart() { $product_id = $_POST[‘product_id’]; $cart = WC()->instance()->cart; $cart_id = $cart->generate_cart_id($product_id); $cart_item_id = $cart->find_product_in_cart($cart_id); if($cart_item_id){ $cart->set_quantity($cart_item_id,0); } wp_die(); }…