• Resolved mutalqureshi

    (@mutalqureshi)


    We are facing a problem here when a user searches for a result without inputting anything into the search form search, the form not submits.

    Is it possible or how do i search without inputting anything into the search form, similar like default wordpress search?

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hi,

    So, as I understand, you want an option to submit an empty search form. So in this case what search results page must display – all available shop pages or maybe something else?

    Regards

    Thread Starter mutalqureshi

    (@mutalqureshi)

    Yes, thats correct. It will display all available on shop page.

    • This reply was modified 3 years, 3 months ago by mutalqureshi.
    Plugin Author ILLID

    (@mihail-barinov)

    Looks like I found the solution for you. Please use following code snippet

    add_action( 'wp_head', 'my_aws_head' );
    function my_aws_head() { ?>
        <script>
            window.addEventListener('load', function() {
                jQuery('.aws-search-btn').on( 'click', function (e) {
                    var form = jQuery(this).closest('.aws-search-form');
                    var searchField = form.find('.aws-search-field');
                    if ( searchField.val() === '' ) {
                        searchField.val('');
                        window.location.href = '/shop/';
                    }
                });
            }, false);
        </script>
    <?php }

    You need to add it somewhere outside the plugins folder. For example, inside functions.php file of your theme or use some plugin for adding code snippets.

    Regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Blank Search form’ is closed to new replies.