How to Display Featured Products First on Shop, Category, Tag, and Search Pages in WooCommerce – 2026

Last updated on November 22nd, 2024 at 08:26 am

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 _featured meta key, ensuring featured products are prioritised.
  • Orderby Modification: Sets the order to prioritise featured products, followed by newer items.
See also  How to Add Social Sharing Buttons to the WooCommerce Single Product Page Without a Plugin - 2026

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

  1. Set Products as Featured: In the WooCommerce product editor, mark your desired products as “Featured.”
  2. Front-End Display: Featured products will automatically appear first on the shop, category, tag, and search pages.
  3. Styling: Optionally, apply custom styling to make featured products visually stand out.
See also  How to Display WooCommerce Product Category Price Range - 2026

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.

0 0 votes
Article Rating

Stay In Touch

Was this post helpful? Why not show your support and buy me a coffee?

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Scroll to Top
0
Would love your thoughts, please comment.x
()
x
×