• Resolved mattborgman

    (@mattborgman)


    I am building an online store and have tried to customize the search results page. All I want to do is add a search bar to the body and change the text that displays when products are found.

    When using the built in WordPress search I am able to edit the search results page by editing search.php, but this does not display prices for my products and the select options button. Therefore I would like to use the woocommerce product search widget that is in the header by default in Storefront the parent theme I am using. But when I use the woocommerce product search the changes from search.php have no effect.

    I have looked online and I can’t seem to find which file I should be editing other than search.php

    Any help would be greatly appreciated.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @mattborgman ,

    This is an interesting topic.

    WooCommerce uses the “archive-product.php” file to show search page results. There is no separate search page template.

    You have to override this file in your child theme and customize its content inside the conditional is_search().

    You can do it directly on the archive-product.php file –

    if ( is_search() ) {
        //put your search results markup here (you can copy some code from archive-product.php file and also from content-product.php to create a standard markup
    } else {
        // here goes the content that is already in that file (archive-product.php) 
    }

    Or you can create another template file and call them like this –

    if (is_search())
        wc_get_template_part( 'content', 'product-custom' );
    else
        wc_get_template_part( 'content', 'product' );

    Here are two related discussions –
    https://stackoverflow.com/questions/23490317/woocommerce-search-result-template
    https://wordpress.stackexchange.com/questions/342006/woocommerce-product-search-result-layout-page

    I hope this information helps.

    Thank you ??

    Hi there,

    We’ve not heard back from you in a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Thank you ??

    Thread Starter mattborgman

    (@mattborgman)

    I apologize,

    I did not see a way to mark a reply as answer, but I do see now on the right side where you can mark the topic as resolved.

    I will keep that in mind for next time.

    And yes, your response did solve my issue, thank you very much!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Which file to edit to customize search results page in Woocommerce’ is closed to new replies.