How to get woocommerce featured products in wordpress inside a product loop. We provide below code to get woocommerce featured products in loop. Woocommerce by default provide the short code to view featured products.
We can display WooCommerce Featured Products Without a Shortcode.
What is Featured Products in WordPress?
When logged into WordPress simply navigate to the ‘Products’ section and you’ll notice that there is a column containing stars. See in screenshot..
If a star in this column is black it means it is featured. To add or remove a product to the list of featured products you simply click the star. Copy and paste below code in your template file.
$args = array( 'post_type' => 'product', 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => 1 );$featured_query = new WP_Query( $args );if ($featured_query->have_posts()) : while ($featured_query->have_posts()) : $featured_query->the_post(); $product = get_product( $featured_query->post->ID ); // Output product information here endwhile; endif; wp_reset_query();
How to get woocommerce featured products, how to get woocommerce products by category,how to get woocommerce products,how to get featured products in woocommerce,how to display woocommerce products on custom page,how to display woocommerce products on front page,how to display woocommerce products on homepage,how to display woocommerce products,how to get woocommerce product attributes,how to get featured product in woocommerce,how to get woocommerce product category,how to get woocommerce product,how to get woocommerce product price,how to get woocommerce product id,how to get woocommerce product image,how to get product in woocommerce,how to display woocommerce products on page,woocommerce get featured product query,how to get woocommerce product short description,how to get woocommerce product title,how to get woocommerce product variations