Home / Forums / WoodMart support forum / PHP Warning that is null creates an empty shop
Home › Forums › WoodMart support forum › PHP Warning that is null creates an empty shop
PHP Warning that is null creates an empty shop
- This topic has 33 replies, 4 voices, and was last updated 1 month, 1 week ago by
Serg Sokhatskyi.
-
AuthorPosts
-
November 18, 2024 at 12:25 pm #612912
supp0rtParticipantHello,
I am trying to figure out a strange behaviour that happens on the shop age.
I see the error below
[PHP Warning]: Attempt to read property “query_vars” on null in wp-content/plugins/woocommerce/includes/class-wc-query.php on line 873
Stack trace:
#0 wp-content/plugins/woocommerce/includes/class-wc-query.php(873): cstm_error_handler()
#1 wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/Filterer.php(150): get_main_meta_query()
#2 wp-content/themes/woodmart/inc/widgets/class-widget-layered-nav.php(459): get_filtered_term_product_counts()
#3 wp-content/themes/woodmart/inc/widgets/class-widget-layered-nav.php(560): get_filtered_term_product_counts()
#4 wp-content/themes/woodmart/inc/widgets/class-widget-layered-nav.php(244): layered_nav_list()
#5 wp-includes/class-wp-widget.php(394): widget()
#6 wp-includes/widgets.php(845): display_callback()
#7 wp-content/themes/woodmart/sidebar.php(34): dynamic_sidebar()
#8 wp-includes/template.php(810): require_once()
#9 wp-includes/template.php(745): load_template()
#10 wp-includes/general-template.php(136): locate_template()
#11 wp-content/plugins/woocommerce/templates/global/sidebar.php(22): get_sidebar()
#12 wp-content/plugins[PHP Warning]: Attempt to read property “post_count” on null in wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-price-filter.php on line 80
Stack trace:
#0 wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-price-filter.php(80): cstm_error_handler()
#1 wp-includes/class-wp-widget.php(394): widget()
#2 wp-includes/widgets.php(845): display_callback()
#3 wp-content/themes/woodmart/sidebar.php(34): dynamic_sidebar()
#4 wp-includes/template.php(810): require_once()
#5 wp-includes/template.php(745): load_template()
#6 wp-includes/general-template.php(136): locate_template()
#7 wp-content/plugins/woocommerce/templates/global/sidebar.php(22): get_sidebar()
#8 wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include()
#9 wp-content/plugins/woocommerce/includes/wc-template-functions.php(1053): wc_get_template()
#10 wp-includes/class-wp-hook.php(324): woocommerce_get_sidebar()
#11 wp-includes/class-wp-hook.php(348): apply_filters()
#12 wp-includes/plugin.php(517): do_action()
#13 wp-content/themes/woodmart/woocommerce/archive-product.php(40): do_action()
#14 wp-includes/template-loader.php(106): include()
#15 wp-blog-header.php(19): require_once()
#16 index.php(17): require()Because of this warning, the shop page appears empty every time the warnings above appear, and the price filter does not appear at all. But reappear after a while.
I have also deactivated all the plugins and left only Woodmart and WooCommerce and the error still happens. I have also tried using WooCommerce and Storefront, and the error did not appear.
Can you please assist me on this one?
Best Regards
November 18, 2024 at 7:08 pm #613092Hello,
Please disable any plugins not directly related to our theme and provide us with your admin access details. We will log in to your dashboard and investigate the issue. Please ensure that you only keep the following plugins that are necessary for our theme to work correctly:
– WoodMart core
– WooCommerce
– Elementor/WPBakery Page BuilderThank you in advance.
November 20, 2024 at 3:42 pm #613826
supp0rtParticipantHello,
I have provided a login using a token. The rest of the plugins are disabled.
Let me know if you need anything else.
Best Regards
November 20, 2024 at 4:36 pm #613883Could you please write step-by-step instructions on how to reproduce the issue on your website?
November 20, 2024 at 6:51 pm #613951
supp0rtParticipantUnfortunatly no. I hope that you can help me on that one. I only have the debug logs and when the error appears every time I check the shop page there are no products on it and the filter by price does not appear at all. After that, I made the test site, disabled all plugins and left only Woodmart and woocommerce, and the error was still there. No cache was involved. After a while, the products and the price reappeared. So I do not know what is going on except for the warnings above.
The settings that I have on the woocommerce might cause this problem. by enabling the lookup table? That might create conflicts with Woodmart?
That’s all I know so far. except for the warnings with the stack trace that I pasted above.
Let me know if there is something else I can help with.
Best Regards
-
This reply was modified 1 year, 7 months ago by
supp0rt. Reason: Added some extra information
November 21, 2024 at 10:00 am #614075Hello,
Unfortunately, we are unable to determine the exact steps to reproduce this issue based on the current details. Since the behavior you’re experiencing is inconsistent and not easily replicable, it’s challenging to pinpoint the root cause.
Kind Regards
November 28, 2024 at 10:49 pm #617351
supp0rtParticipantWould it be possible to add any checks so that if this happens, it should not make the whole shop appear with 0 products?
I am not aware of the theme’s code in-depth and I can see that woocommerce also creates the error here, so I just suggest the above with good faith. if of course, this can work after the implementation.
Best Regards
November 29, 2024 at 10:14 am #617460Hello,
According to the logs, errors appear in WooCommerce functions. We can’t add any checks there. The only way to fix this is to reproduce.
Kind Regards
November 29, 2024 at 11:22 am #617514
supp0rtParticipantOk. I understand that the situation. If I find what is causing this behaviour I will let you know, in case is something that can be added on your end.
Thank you for your time and support.
Best Regards
November 29, 2024 at 11:28 am #617522Thank you for understanding. I will keep this topic open so you can write here anytime.
February 16, 2026 at 12:04 pm #708695
supp0rtParticipantHello @admin,
It took me some time to investigate this issue and report back on my ticket.
@admin, I’ve performed extensive debugging and noticed this happens when bots aggressively crawl the site, specifically by exhausting all possible filter combinations. In my case, they were crawling every variation available in the shop. Interestingly, the issue disappeared for about two months but resurfaced today, which suggests that a robots.txt implementation is only a partial workaround and not a definitive fix. (I can provide my robots.txt if needed.)Below is a snapshot from my logs:
[09-Nov-2025 02:27:51 UTC] [WC-ANOMALY] PHP warn caught: Attempt to read property "query_vars" on null in /[path-to-site]/wp-content/plugins/woocommerce/includes/class-wc-query.php:891 | uri=/shop/?filter_category=christika-antikeimena&filter_fulo=koritsi&filter_hlikia=0-eos-12-minon,18-eos-21-minon,18-eos-99-eton,3-eton-kai-ano,4-eos-6-eton&filter_brands=chillys | referer= | ua=meta-externalagent/1.1 (+https://developers.facebook.com/docs/sharing/webmasters/crawler) | is_shop=yes | is_product_archive=no[09-Nov-2025 02:27:51 UTC] [WC-ANOMALY] backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/woodmart/woocommerce/archive-product.php'), do_action('woocommerce_sidebar'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_get_sidebar, wc_get_template, include('/plugins/woocommerce/templates/global/sidebar.php'), get_sidebar, locate_template, load_template, require_once('/themes/woodmart/sidebar.php'), dynamic_sidebar, WP_Widget->display_callback, WOODMART_Widget_Layered_Nav->widget, WOODMART_Widget_Layered_Nav->layered_nav_list, WOODMART_Widget_Layered_Nav->get_filtered_term_product_counts, Automattic\WooCommerce\Internal\ProductAttributesLookup\Filterer->get_filtered_term_product_counts, WC_Query::get_main_meta_query, {closure} I investigated whether something interferes with the product query. A key indicator of the problem is that while is_shop is "yes", is_product_archive returns "no".A var_dump of the SQL query during the error revealed the following:
SQL SQL: SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND (wp_posts.ID = '8') AND wp_posts.post_type = 'page' ORDER BY wp_posts.post_date DESCIt appears the main query is being intercepted. Instead of running a product archive query, it defaults to a single page query (fetching the Shop page ID ‘8’). When filter widgets attempt to find products within this “page” context, they find nothing (null), resulting in an empty shop.
Important Note: I noticed that switching to the Storefront theme makes the products reappear immediately. However, this might be a false positive for a permanent fix, as switching themes forces a flush of the rewrite rules and clears transients, which temporarily masks the symptom. The fact that products appear correctly on Category pages but fail on the main Shop page suggests that the conflict specifically affects the Shop’s “Main Query” placeholder handling within the theme.
I have more logs from November if needed, and I am available to provide any further help to debug this.
Just let me know.
Best Regards
February 16, 2026 at 1:20 pm #708709Hello,
Could you please disable all plugins that are not related to our theme and give us all the access so we can monitor these logs in real-time and troubleshoot this issue?
Kind Regards
February 16, 2026 at 2:39 pm #708736
supp0rtParticipantThank you for your answer. I have set up a staging environment and provided you with access. However, this issue is quite unusual: if we can’t reliably find the source causing it, it might not occur in staging either.
So far, while monitoring the staging environment, I haven’t been able to see the error again. That said, you may have additional insight or steps to reproduce it that I’m missing.
I’ve provided access to the staging environment as well as FTP access.
Thank you.
February 24, 2026 at 6:43 pm #709782Hello,
Upon investigation, we’ve discovered that this issue is somehow related to the Jetpack plugin. Since the staging website doesn’t have Jetpack installed, you can’t reproduce the problem there. Could you please try installing the plugin and configuring it to work exactly the same way as it does on the production website?
Thanks,
February 24, 2026 at 8:59 pm #709796
supp0rtParticipant@admin Thank you for your response.
If you are referring to the plugin from Automattic (https://wordpress.org/plugins/jetpack/), it was never installed on the site, and it is also not installed on the production site either. Below, inside the private content, is a list of the currently active plugins on the site. All plugins are currently up-to-date. This also applies to the theme and WordPress.
Let me know if you need anything else.
February 26, 2026 at 10:39 am #709998Hello,
In this case, we need to be able to troubleshoot this further on the website where products disappear frequently. If it doesn’t happen on your staging website, it doesn’t make sense to troubleshoot it there.
Kind Regards
February 26, 2026 at 1:39 pm #710026
supp0rtParticipantCurrently happens on the live site. If you are here, I can respond and create an admin login so you can check right now.
February 26, 2026 at 3:35 pm #710044Yes, please provide us with your production website access so we can check it.
February 26, 2026 at 5:27 pm #710060
supp0rtParticipantI have provided the admin access. At this point, the problem is still there.
Please be carefull this is the live site.
February 26, 2026 at 6:21 pm #710068
supp0rtParticipantIf you want FTP Access, use the one provided before. I have changed the folder to the live site.
I have provided them again below. Query monitor is enabled on the site If you need further investigation.March 2, 2026 at 2:05 pm #710492
supp0rtParticipantMarch 2, 2026 at 4:12 pm #710528Thank you. We have checked the log and noticed that products disappear every day at the same time
2026-03-02_02-27-13 2026-03-01_02-27-36 UTC+0Could you please check with your server provider or check some logs to see which actions are run at that time? Maybe you have some cron mechanism or other tools used.
March 2, 2026 at 4:55 pm #710533
supp0rtParticipantWP-crontrol is enabled on the site, if you want to also check the cron job and might find anything that I miss.
As far as I know, there are no other tools/cron-jobs that might run in the background or on the server, except for the ones of WordPress. But please let me check, and I will get back to you as soon as possible.
March 2, 2026 at 7:40 pm #710559
supp0rtParticipantWould it be possible to update the logger so it records which cron job or action initiated the rewrite?
March 3, 2026 at 9:48 am #710617It looks like it is not related to the WordPress cron mechanism. If it is caused by cron job configured on the server, we are not able to log this. Please contact your server administrators and check for all the configured cron jobs or other scheduled tools.
March 3, 2026 at 8:40 pm #710722
supp0rtParticipantΑfter contacting the server administrators, they said that based on the access logs and the services running on the server, the only activity they can correlate with the timestamps you provided is a series of loopback HTTP requests and wp-cron.php executions.
Specifically, wp-cron.php appears to trigger admin-ajax.php with parameters/variables including wordfence_doScan. This occurs every 20–30 seconds.
They also informed me that there is no node-level monitoring, health-check, or similar service that would initiate loopback HTTP requests to the host.
Do you believe that it could lead to something, if you could add logging on your side (in your error log) to capture when wp-cron.php runs around those times or when the rewriting happens? It may be executing concurrently and would help us correlate events.
March 4, 2026 at 10:05 am #710760Hello,
We have added logs for rewrite rules already. They happen at the moment of time I sent earlier.
Can you disable all these cron jobs and the Wordfence plugin and monitor your website for some time?Kind Regards
March 4, 2026 at 12:13 pm #710793
supp0rtParticipantExcuse me for the confusion. Did not explain this properly. I was asking if you could extend your code so that it could also capture the cron jobs that happened during the rewrites.
Will try to scan the site to check what is happening.
Thank you
-
This reply was modified 3 months, 3 weeks ago by
supp0rt.
March 4, 2026 at 4:28 pm #710849It is not possible to log cronjobs from the server via WordPress. It should be checked in the server’s configuration.
May 14, 2026 at 10:29 am #718433
supp0rtParticipantHello @admin,
I disabled the Wordfence plugin and the WP Crontrol plugin to make sure nothing is interfering with the cron tasks or causing any issues. Had to reflush the permalinks in order to make the shop functional again.
However, the problem happened again today. Could you please check the logs and let me know if I’m missing something?
Best regards
-
This reply was modified 1 year, 7 months ago by
-
AuthorPosts
Tagged: blank shop, empty shop
- You must be logged in to create new topics. Login / Register