WordPress get woocommerce featured products

2

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.

Share.

About Author

Sumith Harshan is the Web Engineer Specializes in Java Script, JQuery, HTML4/5, CSS2/3, PHP, CodeIgniter, CakePHP, J2SE, J2EE, XML, Hacking & Security, Mobile Interface Developing, Magento, Wordpress, Joomla, Drupal,PHPBB,Facebook App Developing and Open cart...etc.

  • 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