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 almaira_shop_product_count_update(){ global $woocommerce; ?> cart->cart_contents_count); ?> 'OR', array( // Simple products type 'key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric' ), array( // Variable products type 'key' => '_min_variation_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric' ) ); $tax_query = array(); $tax_query [] = array( 'tax_query' => array( array( 'taxonomy' => 'product_cat', 'field' => 'term_id', 'terms' => $term_id ) ), ); if($radio=='low-to-high'){ $args = array( 'post_type' => 'product', 'posts_per_page' => $posts_per_page, 'tax_query' => $tax_query, 'orderby' => 'meta_value_num', 'meta_key' => '_price', 'order' => 'ASC', 'paged' => $paged, ); } elseif($radio=='high-to-low'){ $args = array( 'post_type' => 'product', 'posts_per_page' => $posts_per_page, 'tax_query' => $tax_query, 'orderby' => 'meta_value_num', 'meta_key' => '_price', 'order' => 'DESC', 'paged' => $paged, ); }elseif($radio=='onsale'){ $args = array( 'post_type' => 'product', 'posts_per_page' => $posts_per_page, 'tax_query' => $tax_query, 'meta_query'=> $meta_query, 'paged' => $paged, ); }elseif($radio=='featured'){ $args = array( 'post_type' => 'product', 'posts_per_page' => $posts_per_page, 'tax_query' => $tax_query, 'post__in' => wc_get_featured_product_ids(), 'paged' => $paged, ); }else{ $args = array( 'post_type' => 'product', 'posts_per_page' => $posts_per_page, 'tax_query' => $tax_query, 'paged' => $paged, ); } $product = new WP_Query($args); if ( $product->have_posts()){ while ( $product->have_posts() ) : $product->the_post(); wc_get_template_part( 'content', 'product' ); endwhile; if($posts_per_page < $product->found_posts){ echo'