Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi,
    May I know why you think it is using normal archive template?
    To me, it appears to be WooCommerce search widget.

    Thread Starter Devin J Dawson

    (@devinjdawson)

    I misunderstood the purpose of the snippet. You are correct.

    What i am interested in doing is altering the results page. When I type in a search , I want the results to display how the “Shop” (Home) page looks, not how the “Recent Posts” page looks. Currently, when you search a term, the results look like recent posts instead of products.

    Thread Starter Devin J Dawson

    (@devinjdawson)

    woocommerce/templates/archive-product.php is what I am trying to replicate. I would like all search results to look like this.

    Hi,

    Does this post talk about the same thing that you want? Would this help?
    https://www.ads-software.com/support/topic/how-to-make-search-result-page-to-display-woocommerce-products?replies=8

    Thread Starter Devin J Dawson

    (@devinjdawson)

    Thanks for getting back to me again.

    I tried adding this function but it does nothing.

    My worry is that for most plugins that work with woocommerce, I need to be using the archive-product.php template itself.

    In that case, i was wondering if there was a function that works like, “if there is an archives page, then use /woocommerce/archive-product.php” as it’s template,” or, “if there is a search page, then use /woocommerce/archive-product.php as it’s template.”

    Directly altering my index.php file does not necessarily improve the situation.

    Thread Starter Devin J Dawson

    (@devinjdawson)

    It seems the information you posted is probably applicable, but i do not know where to apply it within the index.php. Previously i was just adding the function in the linked article, but i see now that I had to edit the index as well. The example they use are for separate index, search, and archive files. With customizr, I believe there is only the index.

    In that case, what do I need to edit in the index file to make it so it applies the <?php get_template_part('woocommerce/archive', 'product'); ?> to the search and archives templates?

    Hi,
    I tried replicating your issue. The default behaviour itself is that of using archive-product template.

    Here are the steps.
    1.Added a HTML5 search button on the menu using the snippet.
    https://presscustomizr.com/snippet/adding-an-html5-search-form-in-your-wordpress-menu/
    2.Replaced get_search_form(false) with get_product_search_form(false).
    3.Searched for some text in this search form. The results were displayed using archive-product.php

    Am I missing something here?

    Thread Starter Devin J Dawson

    (@devinjdawson)

    Thank you for your feedback. It seems that a plugin has corrupted the database and I have to start from scratch. I appreciate your help, sorry for the misunderstanding.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘get_product_search_form not working’ is closed to new replies.