Close Menu
    Facebook X (Twitter) Instagram
    Oixiesoft
    • Home
    • Services
      • WordPress Malware Removal
      • Fix WordPress Errors
      • WordPress Website Development
    • Articles
    • Contact
    Oixiesoft
    Home»Wordpress»How to filter by featured products in admin in Woocommerce
    Wordpress

    How to filter by featured products in admin in Woocommerce

    Editorial StaffBy Editorial StaffNo Comments2 Mins Read
    Share
    Facebook Twitter LinkedIn Pinterest Email

    In Woocommerce, We can filter the products by category, product type, stock status, quantity, etc. But we cannot filter the products by featured products by default. In this article, We will show you how to filter products by featured products in the Woocommerce backend.

    We can easily add and remove any product to the featured products by clicking on the star icon. But when we have thousands of products and need to remove any product from the featured products list, It is not easy to find the products without any filter.

    How to filter products by featured products in the Woocommerce backend

    Add the below code in the theme function.php file.

    /**
    * Filter products by type
    *
    * @access public
    * @return void
    */
    function wpa104537_filter_products_by_featured_status() {
    
    global $typenow, $wp_query;
    
    if ($typenow=='product') :
    
    // Featured/ Not Featured
    $output .= "<select name='featured_status' id='dropdown_featured_status'>";
    $output .= '<option value="">'.__( 'Show All Featured Statuses', 'woocommerce' ).'</option>';
    
    $output .="<option value='featured' ";
    if ( isset( $_GET['featured_status'] ) ) $output .= selected('featured', $_GET['featured_status'], false);
    $output .=">".__( 'Featured', 'woocommerce' )."</option>";
    
    $output .="<option value='normal' ";
    if ( isset( $_GET['featured_status'] ) ) $output .= selected('normal', $_GET['featured_status'], false);
    $output .=">".__( 'Not Featured', 'woocommerce' )."</option>";
    
    $output .="</select>";
    
    echo $output;
    endif;
    }
    
    add_action('restrict_manage_posts', 'wpa104537_filter_products_by_featured_status');

     

    /**
    * Filter the products in admin based on options
    *
    * @access public
    * @param mixed $query
    * @return void
    */
    function wpa104537_featured_products_admin_filter_query( $query ) {
    global $typenow;
    
    if ( $typenow == 'product' ) {
    
    // Subtypes
    if ( ! empty( $_GET['featured_status'] ) ) {
    if ( $_GET['featured_status'] == 'featured' ) {
    $query->query_vars['tax_query'][] = array(
    'taxonomy' => 'product_visibility',
    'field' => 'slug',
    'terms' => 'featured',
    );
    } elseif ( $_GET['featured_status'] == 'normal' ) {
    $query->query_vars['tax_query'][] = array(
    'taxonomy' => 'product_visibility',
    'field' => 'slug',
    'terms' => 'featured',
    'operator' => 'NOT IN',
    );
    }
    }
    
    }
    
    }
    add_filter( 'parse_query', 'wpa104537_featured_products_admin_filter_query' );

    After adding the both code, you will see new filter option in the backend:

    how to filter products by featured products in the Woocommerce backend

    Now you can see all featured products together.

    Share. Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Tumblr Email
    Editorial Staff

    Related Posts

    WordPress Pharma Hack – How To Fix

    How to Set Post Expiration Date in WordPress

    How to Enqueue Scripts Using wp_enqueue_scripts Hook in WordPress

    WordPress Pharma Hack – How To Fix

    How to Set Post Expiration Date in WordPress

    How to Enqueue Scripts Using wp_enqueue_scripts Hook in WordPress

    How to Update PHP in WordPress Safely

    How to Fix Broken Permalinks in WordPress?

    Fixed Unable to Create Directory wp-content/uploads. Is its Parent Directory Writable by the Server.

    WordPress Memory Limit – How to Fix or Increase the PHP Memory Limit

    How To Fix Japanese Keyword Hack In WordPress Site?

    How to Add Bullet Points & Numbered Lists in WordPress

    How to Properly Use Heading Tags in WordPress

    How To Fix the “Missing a Temporary Folder” Error in WordPress

    How to Create a Sitemap in WordPress

    How to Disable Emojis in WordPress

    How To Turn Off The RSS Feed In WordPress

    How to Enable Customer Tracking in WooCommerce with Google Analytics

    How to Easily Add Icon Fonts in Your WordPress Theme

    How to Display Your Facebook Page Reviews in WordPress

    How to Start a Podcast (and Make it Successful) in 2024

    How To Fix “The Link You Followed Has Expired” WordPress Error

    How to remove Malware from WordPress website?

    Services
    • Web Development
    • Mobile Application Development
    • WordPress Malware Removal Service
    • Website Design
    • WordPress Development
    • Magento Development
    • Shopify Development
    • SEO Services
    Blog
    • How to Fix the Error Establishing a Database Connection
    • Ping List WordPress
    • How To Fix Japanese Keyword Hack
    • How to remove Malware from WordPress
    Hire Developers
    • Hire WordPress Developer
    • Hire Shopify Developer
    Contact Info
    • Oixiesoft Technologies
      A-40, Block A, I thum Tower, Sector 62, Noida
    • sales@oixiesoft.com
    • Privacy Policy
    • About Us
    • Contact Us
    © 2025 OixieSoft Technologies

    Type above and press Enter to search. Press Esc to cancel.