Home » Wordpress » WordPress get woocommerce featured products

WordPress get woocommerce featured products

In the wordpress woocommerce web site’s contains various featured products and sometimes we want to get the featured products without any plugins.For a example we want to get featured products to create featured slider.So I’m going to tell you have to get woocommerce featured products without any plugins and grammatically.

You can get featured products with using simple worpdress query. But you must understand the correct featured product meta key is the _featured NOT the featured.

Method -1

Method -2

That’s only.

Tags
  • lasantha

    Good article. we can use woocommerce shortcodes also
    eg. [featured_products per_page=”12″ columns=”4″]

    • Thanks for the reply macho.Yeah, then you can get each separate shortcode parameters/attributes and pass them into wordpress custom query and set the layout of the design.
      eg:

      function featured_products($atts){
      extract(shortcode_atts(array(
      ‘per_page’ => 1,
      ‘columns’ =>1
      ), $atts));

      $args = array(
      ‘post_type’ => ‘product’,
      ‘post_status’ => ‘publish’,
      ‘meta_key’ => ‘_featured’,
      ‘meta_value’ => ‘yes’,
      ‘posts_per_page’ => $per_page //parameter
      );

      …………………… etc

      Regards