[Support request] Navigation Search by SKU

Home Forums Support [Support request] Navigation Search by SKU

Home Forums Support Navigation Search by SKU

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #916575
    Jeff

    I am using the code snippet below that I found in the forums to make the default nav search include products only. However, I cannot seem to search by SKU number. Is there something I can add to make this field use SKU as an additional WooCommerce searchable field.

    add_filter( 'generate_navigation_search_output', function() {
        printf(  
            '<form method="get" class="search-form navigation-search" action="%1$s">
                <input type="search" class="search-field" value="%2$s" name="s" title="%3$s" />
                <input type="hidden" name="post_type" value="product" />
            </form>', 
            esc_url( home_url( '/' ) ), 
            esc_attr( get_search_query() ),   
            esc_attr_x( 'Search', 'label', 'generatepress' ) 
        ); 
    } );

    Thanks!

    #916701
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    This topic might help: https://wordpress.org/support/topic/how-to-search-by-products-variable-sku/

    Let me know 🙂

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.