<?php 
$settings = $this->get_settings();
$layout_header = widgetkit_pro_array_get($settings, 'product_layout_header');
$product_num_to_show = widgetkit_pro_array_get($settings, 'product_num_to_show');
$product_column = widgetkit_pro_array_get($settings, 'product_column');
$featured_product_order = widgetkit_pro_array_get($settings, 'featured_product_order');
$product_layout_style = widgetkit_pro_array_get($settings, 'product_layout_style');
?>
    <?php if($layout_header):?>
        <h2><?php echo $layout_header; ?></h2>
    <?php endif;?>

    <div class="row <?php echo $product_layout_style; ?>">
    <?php 
    $tax_query[] = array(
        'taxonomy' => 'product_visibility',
        'field'    => 'name',
        'terms'    => 'featured',
        'operator' => 'IN', // or 'NOT IN' to exclude feature products
    );
    $args = array(
        'post_type'             => 'product', 
        'post_status'           => 'publish',
        'ignore_sticky_posts'   => 1,
        'posts_per_page'        => $product_num_to_show,
        'order'                 => $featured_product_order,
        'tax_query'             => $tax_query,
    );
    $query = new WP_Query($args);
    if($query->have_posts()):
        while($query->have_posts()):
            $query->the_post();
            ?>
            <div class="column col-md-<?php echo 12/$product_column ?>">
                <div class="product-thumb">
                    <?php if(has_post_thumbnail()):?>
                    <?php the_post_thumbnail('full')?>
                    <?php endif;?>
                </div>
                <div class="product-content">
                    <h4><?php echo the_title();?></h4>
                    <?php $price = get_post_meta( get_the_ID(), '_price', true ); ?>
                    <p><?php echo wc_price( $price ); ?></p>
                    <?php echo do_shortcode('[add_to_cart id="'.get_the_ID().'" style="none" show_price="false"]');?>
                </div>
            </div>
            <?php
        endwhile;
        ?>
        <?php
    endif;
    ?>
    </div>