How To Get A List Of Woocommerce Featured Products

If you are using Woocommerce to promote and sell products, you can easily mark some of the products as featured, directly from the product list (All Products page). To display a list of featured products in your project just try:

 

<ul class="products">
    {{products show="featured" size="4" assign_to="featured_products"}}

    {{foreach $featured_products.data as $product}}
    <li class="col-md-3">
        <article class="product">
            <a href="{{$product.post_permalink}}">
                <!-- add "on sale" badge -->
                {{if $product.on_sale}}<span class="onsale">Sale!</span>{{/if}}
                <img src="{{$product.post_thumbnail}}" class="" alt="{{$product.post_title}}" />
				<h4 class="" >
                    <span class="product_name">
                    {{$product.post_title}}
                    </span>
                    
                    <span class="price pull-right">
                        {{if $product.on_sale}}<i class="reg-price">${{$product.regular_price}} </i>{{/if}}
                        <span class="amount">${{$product.price}}</span>
                    </span> 
                </h4>
            </a>
        </article>
    </li>
    {{/foreach}}
</ul>

 

Leave a Reply

Your email address will not be published. Required fields are marked *