• Resolved olgamm

    (@olgamm)


    Hello, I have a new WP shop with no products for now and I want to search for categories but the suggestion is not returning the categories if they are empty.

    Is there a way to fix that? At least manually until I add some products to the shop?

    Thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @olgamm

    You can use this code snippet to make categories appear in autocomplete search results:

    add_filter( 'dgwt/wcas/search/product_cat/args', function ( $args ) {
      $args['hide_empty'] = false;
    
      return $args;
    } );

    You have two ways to add this code to your theme:

    1. Open the functions.php in your child theme and add the code at the end.
    2. or install the Code Snippets plugin and apply this code as a snippet.

    Regards,
    Kris

    Thread Starter olgamm

    (@olgamm)

    That’s perfect, many thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show empty product categories’ is closed to new replies.