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(); ?> array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $_POST['data_cat_slug'], ), array( 'taxonomy' => 'product_visibility', 'terms' => array( 'exclude-from-catalog' ), 'field' => 'name', 'operator' => 'NOT IN', ) ), 'post_type' => 'product', 'orderby' => 'menu_order', 'meta_query' => array( array( 'key' => '_stock_status', 'value' => 'instock' ), array( 'key' => '_backorders', 'value' => 'no' ), ) ); // product filter if($prdct_optn=='random'){ $args = array( 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $_POST['data_cat_slug'], ), array( 'taxonomy' => 'product_visibility', 'terms' => array( 'exclude-from-catalog' ), 'field' => 'name', 'operator' => 'NOT IN', ) ), 'post_type' => 'product', 'orderby' => 'rand', 'meta_query' => array( array( 'key' => '_stock_status', 'value' => 'instock' ), array( 'key' => '_backorders', 'value' => 'no' ), ) ); }elseif($prdct_optn=='featured'){ $args = array( 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $_POST['data_cat_slug'], ), array( 'taxonomy' => 'product_visibility', 'terms' => array( 'exclude-from-catalog' ), 'field' => 'name', 'operator' => 'NOT IN', ) ), 'post_type' => 'product', 'post__in' => wc_get_featured_product_ids(), 'meta_query' => array( array( 'key' => '_stock_status', 'value' => 'instock' ), array( 'key' => '_backorders', 'value' => 'no' ), ) ); }else{ $args = array( 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $_POST['data_cat_slug'], ), array( 'taxonomy' => 'product_visibility', 'terms' => array( 'exclude-from-catalog' ), 'field' => 'name', 'operator' => 'NOT IN', ) ), 'post_type' => 'product', 'orderby' => 'menu_order', 'meta_query' => array( array( 'key' => '_stock_status', 'value' => 'instock' ), array( 'key' => '_backorders', 'value' => 'no' ), ) ); } echo big_store_product_filter_loop($args); exit; } } /*****************************************/ //Product filter for List View ajax filter /*******************************************/ add_action('wp_ajax_big_store_cat_list_filter_ajax', 'big_store_cat_list_filter_ajax'); add_action('wp_ajax_nopriv_big_store_cat_list_filter_ajax', 'big_store_cat_list_filter_ajax'); function big_store_cat_list_filter_ajax(){ $prdct_optn = get_theme_mod('big_store_category_tb_list_optn','recent'); if( taxonomy_exists( 'product_cat' ) ){ // product filter $args = array( 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $_POST['data_cat_slug'], ), array( 'taxonomy' => 'product_visibility', 'terms' => array( 'exclude-from-catalog' ), 'field' => 'name', 'operator' => 'NOT IN', ) ), 'post_type' => 'product', 'orderby' => 'menu_order', 'meta_query' => array( array( 'key' => '_stock_status', 'value' => 'instock' ), array( 'key' => '_backorders', 'value' => 'no' ), ) ); // product filter if($prdct_optn=='random'){ $args = array( 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $_POST['data_cat_slug'], ), array( 'taxonomy' => 'product_visibility', 'terms' => array( 'exclude-from-catalog' ), 'field' => 'name', 'operator' => 'NOT IN', ) ), 'post_type' => 'product', 'orderby' => 'rand', 'meta_query' => array( array( 'key' => '_stock_status', 'value' => 'instock' ), array( 'key' => '_backorders', 'value' => 'no' ), ) ); }elseif($prdct_optn=='featured'){ $args = array( 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $_POST['data_cat_slug'], ), array( 'taxonomy' => 'product_visibility', 'terms' => array( 'exclude-from-catalog' ), 'field' => 'name', 'operator' => 'NOT IN', ) ), 'post_type' => 'product', 'post__in' => wc_get_featured_product_ids(), 'meta_query' => array( array( 'key' => '_stock_status', 'value' => 'instock' ), array( 'key' => '_backorders', 'value' => 'no' ), ) ); }else{ $args = array( 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $_POST['data_cat_slug'], ), array( 'taxonomy' => 'product_visibility', 'terms' => array( 'exclude-from-catalog' ), 'field' => 'name', 'operator' => 'NOT IN', ) ), 'post_type' => 'product', 'orderby' => 'menu_order', 'meta_query' => array( array( 'key' => '_stock_status', 'value' => 'instock' ), array( 'key' => '_backorders', 'value' => 'no' ), ) ); } echo big_store_product_list_filter_loop($args); exit; } } /** * Live autocomplete search feature. * * @since 1.0.0 */ function big_store_search_site(){ $results = new WP_Query( array( 'post_type' => 'product', 'post_status' => 'publish', 'nopaging' => true, 'posts_per_page'=> 100, 's' => $_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' ); /*******************************************************/ //Product filter Featured Product to big show ajax filter /*******************************************************/ add_action( 'wp_ajax_big_store_big_product_cat_filter_default_ajax_loop1', 'big_store_big_product_cat_filter_default_ajax_loop1' ); add_action( 'wp_ajax_nopriv_big_store_big_product_cat_filter_default_ajax_loop1', 'big_store_big_product_cat_filter_default_ajax_loop1' ); function big_store_big_product_cat_filter_default_ajax_loop1(){ $prdct_optn = get_theme_mod('big_store_feature_product_optn','recent'); // product filter if( taxonomy_exists( 'product_cat' ) ){ // product filter $args = array( 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $_POST['data_cat_slug'], ), array( 'taxonomy' => 'product_visibility', 'terms' => array( 'exclude-from-catalog' ), 'field' => 'name', 'operator' => 'NOT IN', ) ), 'post_type' => 'product', 'orderby' => 'menu_order', 'meta_query' => array( array( 'key' => '_stock_status', 'value' => 'instock' ), array( 'key' => '_backorders', 'value' => 'no' ), ) ); if($prdct_optn=='random'){ $args = array( 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $_POST['data_cat_slug'], ), array( 'taxonomy' => 'product_visibility', 'terms' => array( 'exclude-from-catalog' ), 'field' => 'name', 'operator' => 'NOT IN', ) ), 'post_type' => 'product', 'orderby' => 'rand', 'meta_query' => array( array( 'key' => '_stock_status', 'value' => 'instock' ), array( 'key' => '_backorders', 'value' => 'no' ), ) ); }elseif($prdct_optn=='featured'){ $args = array( 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $_POST['data_cat_slug'], ), array( 'taxonomy' => 'product_visibility', 'terms' => array( 'exclude-from-catalog' ), 'field' => 'name', 'operator' => 'NOT IN', ) ), 'post_type' => 'product', 'post__in' => wc_get_featured_product_ids(), 'meta_query' => array( array( 'key' => '_stock_status', 'value' => 'instock' ), array( 'key' => '_backorders', 'value' => 'no' ), ) ); }else{ $args = array( 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $_POST['data_cat_slug'], ), array( 'taxonomy' => 'product_visibility', 'terms' => array( 'exclude-from-catalog' ), 'field' => 'name', 'operator' => 'NOT IN', ) ), 'post_type' => 'product', 'orderby' => 'menu_order', 'ignore_sticky_posts' => 1, 'posts_per_page' => 4, 'meta_query' => array( array( 'key' => '_stock_status', 'value' => 'instock' ), array( 'key' => '_backorders', 'value' => 'no' ), ) ); } $products = new WP_Query( $args ); if ( $products->have_posts() ){ while ( $products->have_posts() ) : $products->the_post(); global $product; $pid = $product->get_id(); ?>