';
}
}
if ( ! function_exists( 'big_store_product_image_end' ) ){
/**
* Thumbnail wrap start.
*/
function big_store_product_image_end(){
echo '
';
}
}
if ( ! function_exists( 'big_store_product_content_start' ) ){
/**
* Thumbnail wrap start.
*/
function big_store_product_content_start(){
echo '';
}
}
if ( ! function_exists( 'big_store_product_content_end' ) ){
/**
* Thumbnail wrap start.
*/
function big_store_product_content_end(){
echo '
';
}
}
/**
* Thunk-product-hover start.
*/
if ( ! function_exists( 'big_store_product_hover_start' ) ){
function big_store_product_hover_start(){
echo'';
// do_action('big_store_wishlist');
// do_action('big_store_compare');
}
}
if ( ! function_exists( 'big_store_product_hover_end' ) ){
/**
* Thumbnail wrap start.
*/
function big_store_product_hover_end(){
echo '
';
}
}
if ( ! function_exists( 'big_store_shop_content_start' ) ){
/**
* Thumbnail wrap start.
*/
function big_store_shop_content_start(){
$viewshow = get_theme_mod('big_store_prd_view','grid-view');
if($viewshow == 'grid-view'){
echo '';
}else{
echo '
';
}
}
}
if ( ! function_exists( 'big_store_shop_content_end' ) ){
/**
* Thumbnail wrap start.
*/
function big_store_shop_content_end(){
echo '
';
}
}
function big_store_quickview(){
do_action('quickview');
}
/**
* Shop customization.
*
* @return void
*/
add_action( 'woocommerce_before_shop_loop_item', 'big_store_product_meta_start', 10);
add_action( 'woocommerce_after_shop_loop_item', 'big_store_product_meta_end', 12 );
add_action( 'woocommerce_before_shop_loop_item_title', 'big_store_product_content_start',20);
add_action( 'woocommerce_after_shop_loop_item_title', 'big_store_product_content_end', 20 );
add_action( 'woocommerce_after_shop_loop_item_title', 'big_store_product_hover_start',50);
add_action( 'woocommerce_after_shop_loop_item', 'big_store_product_hover_end',20);
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_open',20);
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_open',0);
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_rating', 20);
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price',0);
add_action( 'woocommerce_before_shop_loop_item_title', 'big_store_product_image_start', 0);
add_action( 'woocommerce_before_shop_loop_item_title', 'big_store_product_image_end',10 );
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_show_product_sale_flash',4);
add_action( 'woocommerce_after_shop_loop_item', 'big_store_whish_list',11);
add_action( 'woocommerce_after_shop_loop_item', 'big_store_quickview',11);
add_action( 'woocommerce_after_shop_loop_item', 'big_store_add_to_compare_fltr',11);
add_action( 'woocommerce_before_shop_loop', 'big_store_shop_content_start',1);
add_action( 'woocommerce_after_shop_loop', 'big_store_shop_content_end',1);
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open');
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
/***************/
// single page
/***************/
if ( ! function_exists( 'big_store_single_summary_start' ) ){
/**
* Thumbnail wrap start.
*/
function big_store_single_summary_start(){
echo '
';
}
}
if( ! function_exists( 'big_store_single_summary_end' ) ){
/**
* Thumbnail wrap start.
*/
function big_store_single_summary_end(){
echo '
';
}
}
add_action( 'woocommerce_before_single_product_summary', 'big_store_single_summary_start',0);
add_action( 'woocommerce_after_single_product_summary', 'big_store_single_summary_end',0);
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_output_product_data_tabs',40 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
add_filter( 'woocommerce_product_tabs', 'big_store_woocommerce_custom_product_tabs', 40 );
function big_store_woocommerce_custom_product_tabs( $tabs ) {
$tabs['delivery_information'] = array(
'title' => __( 'Meta Information', 'big-store' ),
'priority' => 10,
'callback' => 'woocommerce_product_meta_tab'
);
return $tabs;
}
function woocommerce_product_meta_tab(){// this is where you indicate what appears in the description tab
wc_get_template( 'single-product/meta.php' ); // The meta content first
}
/**
* Add next/prev buttons @ WooCommerce Single Product Page
*/
add_action( 'woocommerce_single_product_summary', 'big_store_prev_next_product',0 );
// and if you also want them at the bottom...
add_action( 'woocommerce_single_product_summary', 'big_store_prev_next_product',0 );
function big_store_prev_next_product(){
echo '
';
// 'product_cat' will make sure to return next/prev from current category
$previous = next_post_link('%link', '←', TRUE, ' ', 'product_cat');
$next = previous_post_link('%link', '→', TRUE, ' ', 'product_cat');
echo $previous;
echo $next;
echo '
';
}
/****************/
// add to compare
/****************/
function big_store_add_to_compare_fltr(){
global $product;
$product_id = $product->get_id();
if( is_plugin_active('yith-woocommerce-compare/init.php') ){
echo '
';
}
}
/**********************/
/** wishlist **/
/**********************/
function big_store_whish_list(){
if( shortcode_exists( 'yith_wcwl_add_to_wishlist' ) ){
echo '
'.do_shortcode('[yith_wcwl_add_to_wishlist icon="fa fa-heart" label='.__('wishlist','big-store').'
already_in_wishslist_text='.__('Already','big-store').' browse_wishlist_text='.__('Added','big-store').']' ).'
';
}
}
function big_store_whishlist_url(){
$wishlist_page_id = get_option( 'yith_wcwl_wishlist_page_id' );
$wishlist_permalink = get_the_permalink( $wishlist_page_id );
return $wishlist_permalink ;
}
// shop open
/** My Account Menu **/
function big_store_account(){
if ( is_user_logged_in() ){
$return = '
'.__('Account','big-store').'';
}
else {
$return = '
'.__('Register','big-store').'';
}
echo $return;
}
// Plus Minus Quantity Buttons @ WooCommerce Single Product Page
add_action( 'woocommerce_before_add_to_cart_quantity', 'big_store_display_quantity_plus',10,2 );
function big_store_display_quantity_plus(){
echo '
';
}
add_action( 'woocommerce_after_add_to_cart_quantity', 'big_store_display_quantity_minus',10,2 );
function big_store_display_quantity_minus(){
echo '
';
}
//Woocommerce: How to remove page-title at the home/shop page but not category pages
add_filter( 'woocommerce_show_page_title', 'big_store_not_a_shop_page' );
function big_store_not_a_shop_page() {
return boolval(!is_shop());
}
//************************************************************************************************//
// *****************************HOME PAGE WOO FUNCTION****************************************//
//************************************************************************************************//
//***********************/
// product category list
//************************/
function big_store_product_list_categories( $args = '' ){
$term = get_theme_mod('big_store_exclde_category','');
if(!empty($term['0'])){
$exclude_id = $term;
}else{
$exclude_id = '';
}
$defaults = array(
'child_of' => 0,
'current_category' => 0,
'depth' => 5,
'echo' => 0,
'exclude' => $exclude_id,
'exclude_tree' => '',
'feed' => '',
'feed_image' => '',
'feed_type' => '',
'hide_empty' => 1,
'hide_title_if_empty' => false,
'hierarchical' => true,
'order' => 'ASC',
'orderby' => 'menu_order',
'separator' => '
',
'show_count' => 0,
'show_option_all' => '',
'show_option_none' => __( 'No categories','big-store' ),
'style' => 'list',
'taxonomy' => 'product_cat',
'title_li' => '',
'use_desc_for_title' => 0,
);
$html = wp_list_categories($defaults);
echo '
';
}
function big_store_product_list_categories_mobile( $args = '' ){
$defaults = array(
'child_of' => 0,
'current_category' => 0,
'depth' => 2,
'echo' => 0,
'exclude' => '',
'exclude_tree' => '',
'feed' => '',
'feed_image' => '',
'feed_type' => '',
'hide_empty' => 1,
'hide_title_if_empty' => false,
'hierarchical' => true,
'order' => 'ASC',
'orderby' => 'menu_order',
'separator' => '
',
'show_count' => 0,
'show_option_all' => '',
'show_option_none' => __( 'No categories','big-store' ),
'style' => 'list',
'taxonomy' => 'product_cat',
'title_li' => '',
'use_desc_for_title' => 0,
);
$html = wp_list_categories($defaults);
echo '
';
}
function big_store_product_list_categories_slider( $args = '' ){
$term = get_theme_mod('big_store_include_category_slider','0');
if(!empty($term['0'])){
$include_id = $term;
}else{
$include_id = '';
}
$defaults = array(
'child_of' => 0,
'current_category' => 0,
'depth' => 2,
'echo' => 0,
'exclude' => '',
'exclude_tree' => '',
'include' => $include_id,
'feed' => '',
'feed_image' => '',
'feed_type' => '',
'hide_empty' => 1,
'hide_title_if_empty' => false,
'hierarchical' => true,
'order' => 'ASC',
'orderby' => 'menu_order',
'separator' => '
',
'show_count' => 0,
'show_option_all' => '',
'show_option_none' => __( 'No categories','big-store' ),
'style' => 'list',
'taxonomy' => 'product_cat',
'title_li' => '',
'use_desc_for_title' => 0,
'walker' => new List_Category_Images
);
$html = wp_list_categories($defaults);
echo '
';
}
// cLASS To fetch cat image
class List_Category_Images extends Walker_Category {
function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
$saved_data = get_term_meta( $category->term_id, 'thumbnail_id', true );
$image = wp_get_attachment_url( $saved_data);
$cat_name = apply_filters(
'list_cats',
esc_attr( $category->name ),
$category
);
$link='';
$link.= '
description ) ) {
$link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"';
}
$link .= '>';
if(!empty($image)){
$link .='
';
}
$link .= $cat_name . '';
if ( ! empty( $args['show_count'] ) ) {
$link .= ' (' . number_format_i18n( $category->count ) . ')';
}
if ( 'list' == $args['style'] ) {
$output .= "\t
term_id;
if ( ! empty( $args['current_category'] ) ) {
$_current_category = get_term( $args['current_category'], $category->taxonomy );
if ( $category->term_id == $args['current_category'] ) {
$class .= ' current-cat';
} elseif ( $category->term_id == $_current_category->parent ) {
$class .= ' current-cat-parent';
}
}
$output .= ' class="' . $class . '"';
$output .= ">$link\n";
} else {
$output .= "\t$link
\n";
}
}
}
/********************************/
//product slider loop
/********************************/
function big_store_product_slide_list_loop($term_id,$prdct_optn){
// product filter
if(empty($term_id[0])){
$taxquery = array(
array(
'taxonomy' => 'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
}else{
// category filter
$args1 = array(
'orderby' => 'menu_order',
'order' => 'ASC',
'hide_empty' => 1,
'slug' => $term_id
);
$product_categories = get_terms( 'product_cat', $args1);
$product_cat_slug = $product_categories[0]->slug;
$taxquery = array(
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => $product_cat_slug
),array(
'taxonomy' => 'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
}
if($prdct_optn=='random'){
$args = array(
'tax_query' => $taxquery,
'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' => $taxquery,
'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' => $taxquery,
'post_type' => 'product',
'orderby' => 'title',
'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();
?>
>
get_rating_count();
$average = $rat_product->get_average_rating();
echo $rating_count = wc_get_rating_html( $average, $rating_count );
?>
get_price_html(); ?>
'menu_order',
'order' => 'ASC',
'hide_empty' => 1,
'slug' => $term_id
);
$product_categories = get_terms( 'product_cat', $args );
$count = count($product_categories);
$cat_list = $cate_product = '';
$cat_list_drop = '';
$i=1;
$dl=0;
?>
0 ){
foreach ( $product_categories as $product_category ){
//global $product;
$category_product = array();
$current_class = '';
$cat_list .='
'.esc_html($product_category->name).'
';
if ($i++ == $device_cat) break;
}
if($count > $device_cat){
foreach ( $product_categories as $product_category ){
//global $product;
$dl++;
if($dl <= $device_cat) continue;
$category_product = array();
$current_class = '';
$cat_list_drop .='
'.esc_html($product_category->name).'
';
}
}
$return = '
';
$return .= $cat_list;
$return .= '
';
if($count > $device_cat){
$return .= '';
}
$return .= '
';
echo $return;
}
}
}
/********************************/
//product cat filter loop
/********************************/
function big_store_product_cat_filter_default_loop($term_id,$prdct_optn){
// product filter
if(empty($term_id[0])){
$taxquery = array(
array(
'taxonomy' => 'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
}else{
// category filter
$args1 = array(
'orderby' => 'menu_order',
'order' => 'ASC',
'hide_empty' => 1,
'slug' => $term_id
);
$product_categories = get_terms( 'product_cat', $args1);
$product_cat_slug = $product_categories[0]->slug;
$taxquery = array(
'relation' => 'AND',
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => $product_cat_slug
),
array(
'taxonomy' => 'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
}
if($prdct_optn=='random'){
$args = array(
'tax_query' => $taxquery,
'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' => $taxquery,
'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' => $taxquery,
'post_type' => 'product',
'orderby' => 'title',
'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();
?>
>
get_rating_count();
$average = $rat_product->get_average_rating();
echo $rating_count = wc_get_rating_html( $average, $rating_count );
?>
get_price_html(); ?>
'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
}else{
// category filter
$args1 = array(
'orderby' => 'menu_order',
'order' => 'ASC',
'hide_empty' => 1,
'slug' => $term_id
);
$product_categories = get_terms( 'product_cat', $args1);
$product_cat_slug = $product_categories[0]->slug;
$taxquery = array(
'relation' => 'AND',
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => $product_cat_slug
),
array(
'taxonomy' => 'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
}
if($prdct_optn=='random'){
$args = array(
'tax_query' => $taxquery,
'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' => $taxquery,
'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' => $taxquery,
'post_type' => 'product',
'fields' => 'ids',
'orderby' => 'title',
'ignore_sticky_posts' => 1,
'posts_per_page' => 4,
'meta_query' => array(
array(
'key' => '_stock_status',
'value' => 'instock'
),
array(
'key' => '_backorders',
'value' => 'no'
),
)
);
}
$products_IDs=array();
$products = new WP_Query( $args );
if ( $products->have_posts() ){
while ( $products->have_posts() ) : $products->the_post();
global $product;
$products_IDs[] = $product->get_id();
endwhile;
}else {
echo __( 'No products found','big-store' );
}
wp_reset_postdata();
return $products_IDs;
}
function big_store_big_product_cat_filter_default_loop1($term_id,$prdct_optn){
// product filter
if(empty($term_id[0])){
$taxquery = array(
array(
'taxonomy' => 'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
}else{
// category filter
$args1 = array(
'orderby' => 'menu_order',
'order' => 'ASC',
'hide_empty' => 1,
'slug' => $term_id
);
$product_categories = get_terms( 'product_cat', $args1);
$product_cat_slug = $product_categories[0]->slug;
$taxquery = array(
'relation' => 'AND',
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => $product_cat_slug
),
array(
'taxonomy' => 'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
}
if($prdct_optn=='random'){
$args = array(
'tax_query' => $taxquery,
'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' => $taxquery,
'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' => $taxquery,
'post_type' => 'product',
'orderby' => 'title',
'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();
?>
>
get_rating_count();
$average = $rat_product->get_average_rating();
echo $rating_count = wc_get_rating_html( $average, $rating_count );
?>
get_price_html(); ?>
'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
}else{
// category filter
$args1 = array(
'orderby' => 'menu_order',
'order' => 'ASC',
'hide_empty' => 1,
'slug' => $term_id
);
$product_categories = get_terms( 'product_cat', $args1);
$product_cat_slug = $product_categories[0]->slug;
$taxquery = array(
'relation' => 'AND',
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => $product_cat_slug
),
array(
'taxonomy' => 'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
}
if($prdct_optn=='random'){
$args = array(
'tax_query' => $taxquery,
'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' => $taxquery,
'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' => $taxquery,
'post_type' => 'product',
'orderby' => 'title',
'post__not_in' => $exludeaary,
'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();
?>
>
get_rating_count();
$average = $rat_product->get_average_rating();
echo $rating_count = wc_get_rating_html( $average, $rating_count );
?>
get_price_html(); ?>
have_posts() ){
while ( $products->have_posts() ) : $products->the_post();
global $product;
$pid = $product->get_id();
$hover_style = get_theme_mod( 'big_store_woo_product_animation' );
if('swap' === $hover_style){
global $product;
$attachment_ids = $product->get_gallery_image_ids();
if(count($attachment_ids) > '0'){
$swapclasses='big-store-swap-item-hover';
}
}elseif('slide' === $hover_style){
global $product;
$attachment_ids = $product->get_gallery_image_ids();
if(count($attachment_ids) > '0'){
$swapclasses='big-store-slide-item-hover';
}
} else{
$swapclasses='';
}
?>
>
get_rating_count();
$average = $rat_product->get_average_rating();
echo $rating_count = wc_get_rating_html( $average, $rating_count );
?>
get_price_html(); ?>
have_posts() ){
while ( $products->have_posts() ) : $products->the_post();
global $product;
$pid = $product->get_id();
?>
>
get_rating_count();
$average = $rat_product->get_average_rating();
echo $rating_count = wc_get_rating_html( $average, $rating_count );
?>
get_price_html(); ?>
'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
}else{
// category filter
$args1 = array(
'orderby' => 'menu_order',
'order' => 'ASC',
'hide_empty' => 1,
'slug' => $term_id
);
$product_categories = get_terms( 'product_cat', $args1);
$product_cat_slug = $product_categories[0]->slug;
$taxquery = array(
'relation' => 'AND',
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => $product_cat_slug
),
array(
'taxonomy' => 'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
}
$args = array(
'tax_query' => $taxquery,
'post_type' => 'product',
'post__in' => wc_get_featured_product_ids(),
'posts_per_page' => 1,
);
$products = new WP_Query( $args );
if ( $products->have_posts() ){
while ( $products->have_posts() ) : $products->the_post();
global $product;
$pid = $product->get_id();
?>
>
get_rating_count();
$average = $rat_product->get_average_rating();
echo $rating_count = wc_get_rating_html( $average, $rating_count );
?>
get_price_html(); ?>
1,
'posts_per_page' => $count,
'post_type' => 'product',
'orderby' => 'date',
'order' => 'DESC',
);
if($productType == 'featured'){
$taxquery = array(
'relation' => 'AND',
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => $cat_slug
),
array(
'taxonomy' => 'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
$args = array(
'tax_query' => $taxquery,
'post_type' => 'product',
'post__in' => wc_get_featured_product_ids(),
);
}
elseif($productType == 'random'){
//random product
$args['orderby'] = 'rand';
}
elseif($productType == 'sale') {
//sale product
$args['meta_query'] = array(
'relation' => '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'
)
);
}
$args['meta_key'] = '_thumbnail_id';
if($cat_slug != '0'){
//$args['product_cat'] = $cat_slug;
$args['tax_query'] = array(
'relation' => 'AND',
array(
'taxonomy' => 'product_cat',
'field' => 'term_id',
'terms' => $cat_slug,
),
array(
'taxonomy' => 'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
)
);
}
$return = new WP_Query($args);
return $return;
}
/*****************************/
// Product show function
/****************************/
function big_store_post_query($query){
$args = array(
'orderby' => $query['orderby'],
'order' => 'DESC',
'ignore_sticky_posts' => $query['sticky'],
'post_type' => 'post',
'posts_per_page' => $query['count'],
'cat' => $query['cate'],
'meta_key' => '_thumbnail_id',
);
if($query['thumbnail']){
$args['meta_key'] = '_thumbnail_id';
}
$return = new WP_Query($args);
return $return;
}