php – WordPress Theme Search Returns Empty When Selecting a Category

Question

So I have a bit of weird issue

Using wordpress, shopemax theme and woocommerce to create my first online store for my local shop in France.

The theme ‘ShopMax’ (Child them of StoreBiz), provides me with a nice built in search feature which the option to select from a category.

The problem is, if I select a category but don’t put in a search term, it returns an empty list, even though the select category can see there are items for said category.

I want it to generate a list of all products within selected category, pretty much the same as if I was to simply the select the category in question from the side widget.

my site is www.thecorner-shop.com

Thanks for any help you can provide.

In the parent theme section-header.php I found this relating to the search feature.

code

                        <div class="header-search-form">
                            <form method="get" action="<?php echo esc_url(home_url("https://wordpress.stackexchange.com/")); ?>">
                                <select class="header-search-select" name="product_cat">
                                    
                                    <option value=""><?php esc_html_e('Select Category', 'shopmax'); ?></option> 
                                    
                                    <?php
                                    $shopmax_categories = get_categories('taxonomy=product_cat');                          
                                    foreach ($shopmax_categories as $shopmax_product_category) {
                                        $shopmax_option = '<option value="' . esc_attr($shopmax_product_category->category_nicename) . '">';
                                        $shopmax_option .= esc_html($shopmax_product_category->cat_name);
                                        $shopmax_option .= ' (' . absint($shopmax_product_category->category_count) . ')';
                                        $shopmax_option .= '</option>';
                                        echo $shopmax_option; // WPCS: XSS OK.
                                    }
                                    ?> 

0
Jozanne 3 weeks 2021-09-28T07:02:23-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse