Missing return in “get_search_query”
-
The “get_search_query” filter function “proceedToSearchGSF($query)” requires a return $query.
If nothing is returned the search page query is blank.The page I need help with: [log in to see the link]
-
Hello,
Greetings from Simprosys Infomedia!
To assist you better with the issue, please help us with a screenshot showing the error or message in your WooCommerce store.
Additionally, we kindly request access to your WooCommerce store to address and resolve the issue. Can you please grant us access to [email protected]?
Here is the help doc to grant us access: https://support.simprosys.com/faq/how-to-grant-access-to-your-woocommerce-store
Awaiting your resonse.
Regards,
Team Simprosys
Hello @distl
We hope this message finds you well. We are following up on our previous response regarding your concern.
If the issue has been resolved, please let us know. If you still have the same issue, please help us with store access so that we can assist you further.
Looking forward to hearing from you soon.
Best Regards,
Team Simprosys!Hi
Sorry I am not able to provide you access to the site that this is being used on.
The problem is that on the WC search page, the search input field and search for title is being cleared / not displaying the last input you may have typed in on submit.
I have made a temporary fix by adding this function “proceedToSearchGSF” to mu-plugins which is overwriting your function.
function proceedToSearchGSF($query) { $search_string = get_query_var('s'); $product_ids = []; $variation_ids = []; $sku = []; $productData = array(); $args = ['s' => $search_string, 'limit' => 5]; $products = wc_get_products($args); if ($products) { foreach ($products as $value) { $variation_id = isset($value->get_children()[0]) ? $value->get_children()[0] : 0; array_push($product_ids, $value->id); array_push($variation_ids, $variation_id); array_push($sku, $value->sku); } } if ($product_ids) { $products_ids = implode(',', $product_ids); } $productData['product_id'] = $product_ids; $productData['search_string'] = $search_string; $productData['variation_id'] = $variation_ids; $productData['sku'] = $sku; callJSFuncGSF($productData, "proceedToSearchGSF"); return $query; /* This was missing from original plugin, remove once plugin returns the query */ }Your function “proceedToSearchGSF” (in helper/helper.php) is filtering the WP core function “get_search_query”
https://wp-kama.com/hook/get_search_query which requires a return $query.If you just search through your plugin code for “proceedToSearchGSF” you will find the function that is missing a return.
Hope this helpsHello @distl
Thank you for taking the initiative to address the issue by adding a script to our plugin’s file. We appreciate your proactive approach to resolving this issue.
We’ve identified the issue and it will be resolved in the upcoming release of our plugin, scheduled to launch soon.
If you encounter any further challenges or require additional assistance, please don’t hesitate to reach out at [email protected]
Best Regards,
Team Simprosys!
The topic ‘Missing return in “get_search_query”’ is closed to new replies.