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

    When searching with the magnify glass and hitting enter, the results url looks like:
    https://website.com/?s=SEARCHTERM

    I want it to instead look like:
    https://website.com/?s=SEARCHTERM&post_type=product

    How do I accomplish this through function.php?

    Edit: To resolve this I need to add <input type=”hidden” name=”post_type” value=”product”>

    Original Code:
    <form action=”https://website.com/&#8221; id=”searchform” method=”get” class=””>
    <div>
    <input type=”submit” value=”” id=”searchsubmit” class=”button avia-font-entypo-fontello”>
    <input type=”text” id=”s” name=”s” placeholder=”Search” value=””>
    </div>
    </form>

    How it should look:
    <form action=”https://website.com/&#8221; id=”searchform” method=”get” class=””>
    <div>
    <input type=”submit” value=”” id=”searchsubmit” class=”button avia-font-entypo-fontello”>
    <input type=”text” id=”s” name=”s” placeholder=”Search” value=””>
    <input type=”hidden” name=”post_type” value=”product”>
    </div>
    </form>

    • This topic was modified 5 years, 3 months ago by GCSkye.
    #1125222

    Hey GCSkye,

    Please have a look at the solution posted here

    Change Search results to products search results (Woocommerce)

    If you need further assistance please let us know.
    Best regards,
    Victoria

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