cart; foreach ($woocommerce->cart->get_cart() as $cart_item_key => $cart_item){ if($cart_item['product_id'] == $_POST['product_id'] ){ // Remove product in the cart using cart_item_key. $cart->remove_cart_item($cart_item_key); woocommerce_mini_cart(); exit(); } } die(); } function big_store_product_count_update(){ global $woocommerce; ?> %d item', '%d items', WC()->cart->get_cart_contents_count(),'big-store' ), WC()->cart->get_cart_contents_count(),'big-store'); ?>cart->get_cart_total(); ?> 'product', 'post_status' => 'publish', 'nopaging' => true, 'posts_per_page'=> 100, 's' => esc_html($_POST['match']), ) ); $items = array(); if ( !empty( $results->posts ) ) { foreach ( $results->posts as $result ) { $items[] = $result->post_title; } } wp_send_json_success( $items ); } add_action( 'wp_ajax_big_store_search_site', 'big_store_search_site' ); add_action( 'wp_ajax_nopriv_big_store_search_site', 'big_store_search_site' );