I have set up a custom loop to display featured products at the top of their relevant category pages.

but now I would like to go about removing featured products from the regular loop below, which is using the standard woocommerce code to display products,

Any help would be greatly appreciated

http://onthesquareauctions.com/index.php/product-category/emporium/furniture/chairs-emporium/ enter image description here

  • Nothing we can do if you don't show the code you are using.
    – cjbj
    Sep 27, 2016 at 12:46
  • Please write some codes, and are you using WooCommerce? Sep 27, 2016 at 12:59
  • sorry, meant to say I'm just using the default woocommerce code for the second loop, i.e. the one i want to remove the featured products from. Sep 27, 2016 at 13:27

2 Answers 2


Use the pre_get_posts filter to remove your sticked product from the product loop.

add_action( 'pre_get_posts', 'exclude_stycky_product' );

function exclude_sticky_product(){
    // target only the main query
    if ( ! is_admin() && $query->is_main_query()  ) {
         $query->set('meta_value', '1');

Hope it helps you !


I like Benoti answer and the other thing you can do is use woocommerce_product_query hook.


 *  Add in your themes functions.php    
 *  Exclude featured product in the main product loop
add_action( 'woocommerce_product_query', function ($query) {

    if ( ! is_admin() && $query->is_main_query() ) {
        // Not a query for an admin page.
        // It's the main query for a front end page of your site.

        if ( is_product_category() ) {
            // It's the main query for a product category archive.

            $tax_query = (array) $query->get( 'tax_query' );

            // Tax query to exclude featured product 
            $tax_query[] = array(
                'taxonomy' => 'product_visibility',
                'field'    => 'name',
                'terms'    => 'featured',
                'operator' => 'NOT IN', 

            $query->set( 'tax_query', $tax_query );


} ); 

see my full notes on this topic https://jameshwartlopez.com/plugin/remove-any-product-that-is-featured-from-regular-display-loop/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.