Prioritising featured products on WooCommerce pages is a great way to showcase your best offerings and encourage customers to explore highlighted items first. By displaying featured products at the top of your shop, category, tag, and search pages, you can increase visibility and sales for these products.
In this guide, we’ll show you how to adjust the product order in WooCommerce to display featured products first on all relevant pages, without the need for a plugin.
Step 1: Customise Product Query to Prioritise Featured Products
The key to displaying featured products first is modifying WooCommerce’s main product query. We’ll achieve this by using a custom function to adjust the query, ensuring that featured products are shown at the top of each page.
Code to Prioritise Featured Products
Add the following code to your theme’s functions.php file or a child theme:
/*
* Snippet: How to Display Featured Products First on Shop, Category, Tag, and Search Pages in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1699
* Tested with WooCommerce 10.7.0
* "This function modifies the WooCommerce query to display featured products first"
*/
function wcsuccess_display_featured_products_first( $query ) {
if ( ! is_admin() && $query->is_main_query() && ( is_shop() || is_product_category() || is_product_tag() || is_search() ) ) {
$meta_query = $query->get( 'meta_query' );
// Add a meta query to check for featured products
$meta_query[] = array(
'relation' => 'OR',
array(
'key' => '_featured',
'value' => 'yes',
'compare' => '='
),
array(
'key' => '_featured',
'compare' => 'NOT EXISTS'
)
);
$query->set( 'meta_query', $meta_query );
// Set order to display featured products first
$query->set( 'orderby', array( 'meta_value' => 'DESC', 'date' => 'DESC' ) );
}
}
add_action( 'pre_get_posts', 'wcsuccess_display_featured_products_first' );
Explanation:
- Condition Check: This function only runs on the front end and only on the main query for shop, category, tag, and search pages.
- Meta Query: The meta query filters products by the
_featuredmeta key, ensuring featured products are prioritised. - Orderby Modification: Sets the order to prioritise featured products, followed by newer items.
Step 2: Customise Product Display Order for Better Visual Impact
To ensure the featured products stand out, you may want to adjust how products are displayed on the shop and category pages by organising them in a grid format and adjusting styling as needed.
Optional Styling for Featured Products
If you’d like to style featured products differently, you can add custom CSS to help them stand out on the page.
/* Highlight featured products */
.product.featured {
border: 2px solid #f39c12; /* Gold border */
padding: 10px;
border-radius: 5px;
}
Explanation:
- CSS for Featured Products: Adds a distinct border to featured products, drawing attention to them on the page.
- Customisable Styling: Adjust the colours, padding, and border as needed to fit your store’s branding.
Example Workflow
- Set Products as Featured: In the WooCommerce product editor, mark your desired products as “Featured.”
- Front-End Display: Featured products will automatically appear first on the shop, category, tag, and search pages.
- Styling: Optionally, apply custom styling to make featured products visually stand out.
Conclusion
Displaying featured products at the top of WooCommerce pages can increase engagement with your highlighted items and boost sales. By following this guide, you can easily showcase your featured products without needing a plugin.
As always, test the changes in a staging environment before deploying to your live site. For more WooCommerce customisations, check out our WooCommerce Visual Hooks Guide or explore our wp-config generator for advanced configurations.
I have been working with WordPress and WooCommerce since 2012 and have developed a deep knowledge of the content management system. Since 2012, I have developed several plugins and designed dozens of websites utilising different frameworks, CMS’s and programming languages. I am proficient in PHP, Python, Java, C, C++, R and JavaScript with limited experience in Go, Kotlin and Swift.
Educationally, I have a Master’s degree in cyber security a Bachelor’s (Hons, First Class) in Applied Research and a Graduate Certificate in Data Science. I’m currently undertaking PhD studies investigating IoT cybersecurity. I recently graduated with First Class Honours and Masters of Information Technology, receiving the Executive Dean’s Award for studies undertaken in the 2021 and 2022 academic years. I have worked in the information technology industry for the past 11 years primarily as a software/web developer specific to design, optimisation, network management and security. My research interests are in the areas of Internet of Things (IoT), 5G and Beyond Networks, information security for wireless networks and software development.
Stay In Touch

