woocommerce 4.4.1 and no product result in relevanssi
-
Hi Mikko
I added your code to fix the problem but nothing happened and it doesnt work for me
code:
add_action( ‘woocommerce_before_shop_loop’, ‘relevanssi_wc_reset_loop’ );
function relevanssi_wc_reset_loop() {
global $wp_query;
if ( $wp_query->is_search ) {
wc_reset_loop();
}
}I am using “woocommerce 4.4.1 ” and theme “Rey – Fashion & Clothing, Furniture”
https://themeforest.net/item/rey-multipurpose-woocommerce-theme/24689383Thank you.
-
Does the Relevanssi search work? If you use the Relevanssi admin search (Dashboard > Admin search), do you get the correct results? Do you get results using a different theme?
In admin search “yes” , i received the search results. i only have this theme with its child-theme , and can not test it with different themes
in front-end after “inspect element” in google chrome i see:
search result for “[empty]”
Filters are displayed in sidebar
and html tag ul in results but “without” li s loop to show results- This reply was modified 4 years, 3 months ago by 616designer.
- This reply was modified 4 years, 3 months ago by 616designer.
- This reply was modified 4 years, 3 months ago by 616designer.
That does sound like a similar problem than what everybody else is having, but why the solution that works for most people doesn’t work in your case is a bit of a mystery.
Can you please install the Storefront theme and try that? You don’t need to switch the theme, just doing a search in the live preview is enough. It would helpful to know if the problem is within your theme or not. If it’s in your theme, I can’t help much, because it’s a premium theme and I have no access to it.
If it’s not your theme, then the question is, can it be one of your other plugins? Which plugins are you using?
we have the same problem:
After update to:
Woocommerce 4.4.1
Wordpress 5.50
Storefront 2.6
Relevanssi 4.8the search no longer works.
Settings not changed.Index read in again.
On our website Blog without Woocommerce, the search function works with Relevanssi after an update.
Druideniggi, have you added the fix code from here? If not, please try that. If you have tried it and it still doesn’t work, what other plugins are you using? I know that Storefront 2.6 is not a problem, the fix works on my test site which is running Storefront.
We have not adopted this script in our live system.
We have inserted the script in our test system. Unfortunately, it doesn’t work.
installed plugins
Advanced Order Export For WooCommerce
All In One SEO Pack
Autocomplete For Relevanssi
Autoptimize
Code Snippets
Contact Form 7
Contact Form CFDB7
Cool Tag Cloud
Custom Product Tabs for WooCommerce
Export WooCommerce Pro
Germanized for WooCommerce
Google Analytics Opt-Out (DSGVO / GDPR)
Newsletter
Newsletter – Addons Manager
Newsletter – API
Newsletter – WP Users Integration
Product Enquiry for WooCommerce
QR Code for WooCommerce
Regenerate Thumbnails
Related Products for WooCommerce
Relevanssi
ShortPixel Image Optimizer
Stackable – Gutenberg Blocks
Sticky Side Buttons
Storefront Powerpack
Ultimate Addons for Gutenberg
Variation Swatches for WooCommerce
WC Duplicate Order
Widget Options
WooCommerce
WooCommerce Accordions
WooCommerce Bulk Discount
WooCommerce Email Validation
WooCommerce Google Product Feed
WooCommerce PDF Invoices & Packing Slips
WooCommerce Product Bundles
WP-DBManager
WP Crontrol
WPC Smart Quick View for WooCommerce
WPFront Scroll Top
WP Statistics
WP Wiki Tooltip
YITH WooCommerce Wishlist Premiumi tested it with “storefront.2.6.0” unfortunately, relevanssi did not show the search results
- This reply was modified 4 years, 2 months ago by 616designer.
- This reply was modified 4 years, 2 months ago by 616designer.
I had the same symptoms appear on a site today that recently was updated. Same versions as posted by druideniggi. Mikko’s fix worked for me but I thought I should share some information to help out.
I narrowed down the issue to woocommerce file wc-template-functions.php, inside of the function wc_setup_loop(). In this function, it pulls in the “total” (number of posts) but that was being loaded as zero the first time it gets called. WooCommerce cached that even though the $wp_query is updated later to have the correct number of results. So even though my page says “17 products found”, WooCommerce thinks the loop is empty and doesn’t run. Even though $wp_query has been updated and has 17 results.
The solution is wc_reset_loop() which is exactly what Mikko’s code does. That fix corrects that issue by resetting the “loop” (what I described in the 2nd paragraph). Thank you Mikko! This fix worked for me.
For everyone else I encourage you to make sure that code is actually running. There’s plenty of ways to do it but I’ll share a quick and dirty way. Only use this method if you have FTP/SSH access.
To start, just add
echo "TESTING"; exit;
at the end of Mikko’s function. It should break the page and just say “testing” with no products to display. That will tell you Mikko’s code is running and so your issue is probably different. But if you do not get a broken page that says “testing” after uploading that change, the function is not running. It could be that your page is cached, you put it in a file that isn’t being included, or something else. This is just some basic “sanity testing”. Obviously remove that code when you tested.An alternative fix, much less elegant, is to copy the WC template “archive-product.php” to your theme’s woocommerce templates folder if you don’t already have it there. Edit that template and just before “woocommerce_product_loop_start()” you should add “wc_reset_loop();”. This is effectively identical to Mikko’s solution but if your hook wasn’t working, this is basically hard-coding that patch into this specific template. There is no reason why the should work when Mikko’s did not, unless you put Mikko’s code in the wrong spot. But it’s worth trying anyway as it will tell you if it is the same problem.
Hope this helps
@radgh thank you for spending time to help
adding “wc_reset_loop();” in product archive file helps but i miss the number of found results in search page and somehow for users it is important .
after update woocommerce 4.4 i’ve faced with this problem and before that, relevanssi worked perfectly
anyway, i have to use some extra codes in function file to consider tags in searches … and wait for future updates
thank you all@radgh, in case you’re interested to reading more about what’s actually the problem here, here’s my description of the problem at WooCommerce issue tracker.
@616designer, with the
wc_reset_loop()
in the right place, the number of found posts should be correct in the theme, as long as the theme doesn’t do anything funny. If it worked before, it should work now with the loop reset.@druideniggi, try the debugging methods outlined by radgh and see if that helps.
Thank you for your possible solutions. Since I do not want to hear the wc_funktions.php and it is not safe to update, I saw Relevanssi for the first time and continues to work with the WP standard search. Relevanssi is an interactive plugin for fine tuning the search and I will try again after the update. I am not that expert. I’m more of the marketing expert. ??
I take this problem with migrating jquery put together. I saw this snippet in the wp funktions.php:
/**
* Dequeue jQuery Migrate Script in WordPress.
*/
if ( ! function_exists( ‘evolution_remove_jquery_migrate’ ) ) :function evolution_remove_jquery_migrate( &$scripts) {
if(!is_admin()) {
$scripts->remove( ‘jquery’);
$scripts->add( ‘jquery’, false, array( ‘jquery-core’ ), ‘1.12.4’ );
}
}
add_filter( ‘wp_default_scripts’, ‘evolution_remove_jquery_migrate’ );
endif;That accelerates the page speed a lot. If I turn off the snippet, the pagesped goes from 90 points to 45 points. That belongs to me.
Thanks for your quick update. with version 4.81 everything is perfect again. ??
- The topic ‘woocommerce 4.4.1 and no product result in relevanssi’ is closed to new replies.