• Resolved buildblog

    (@buildblog)


    I’m having memory issues with WooCommerce. I originally copied a previous site. Now all I have is a stanadrd WP theme and WooCommerce installed and I’m getting this error when viewing the site.

    I’ve never had memory issues before with WooCommerce. Any thoughts please?

    Thanks.

    Warning: Invalid argument supplied for foreach() in /home/webuildy/public_html/clientwebsitetemplate.com/kdf/wp-content/plugins/woocommerce/includes/wc-webhook-functions.php on line 176

    Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 16793600 bytes) in /home/webuildy/public_html/clientwebsitetemplate.com/kdf/wp-includes/class-wpdb.php on line 2351

    WordPress database error: [Commands out of sync; you can't run this command now]
    SELECT option_value FROM wpl1_options WHERE option_name = 'woocommerce_cart_page_id' LIMIT 1

    There has been a critical error on this website.

    Learn more about troubleshooting WordPress.

    WordPress database error: [Commands out of sync; you can't run this command now]
    SELECT option_value FROM wpl1_options WHERE option_name = 'woocommerce_logs_logging_enabled' LIMIT 1

    WordPress database error: [Commands out of sync; you can't run this command now]
    SELECT option_value FROM wpl1_options WHERE option_name = 'woocommerce_logs_level_threshold' LIMIT 1

    WordPress database error: [Commands out of sync; you can't run this command now]
    SELECT option_value FROM wpl1_options WHERE option_name = 'woocommerce_logs_default_handler' LIMIT 1

    WordPress database error: [Commands out of sync; you can't run this command now]
    SELECT option_value FROM wpl1_options WHERE option_name = 'ftp_credentials' LIMIT 1

    WordPress database error: [Commands out of sync; you can't run this command now]
    SELECT option_name, option_value FROM wpl1_options WHERE option_name IN ('_site_transient_woocommerce_new_version','_site_transient_timeout_woocommerce_new_version')

    WordPress database error: [Commands out of sync; you can't run this command now]
    SELECT option_value FROM wpl1_options WHERE option_name = '_site_transient_update_plugins' LIMIT 1

    WordPress database error: [Commands out of sync; you can't run this command now]
    INSERT INTO wpl1_options (option_name, option_value, autoload) VALUES ('_site_transient_timeout_woocommerce_new_version', '1751884816', 'off') ON DUPLICATE KEY UPDATE option_name = VALUES(option_name), option_value = VALUES(option_value), autoload = VALUES(autoload)

    WordPress database error: [Commands out of sync; you can't run this command now]
    INSERT INTO wpl1_options (option_name, option_value, autoload) VALUES ('_site_transient_woocommerce_new_version', '', 'off') ON DUPLICATE KEY UPDATE option_name = VALUES(option_name), option_value = VALUES(option_value), autoload = VALUES(autoload)

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @buildblog,

    Thanks for reaching out. I can imagine how disruptive it is to encounter a fatal memory error right at the start of your build.

    From what you’ve shared, it looks like your site is hitting the PHP memory limit of 512 MB, triggered during database operations involving WooCommerce, especially within webhook functions and core DB queries.

    Here are a few things to check and try:

    1. Increase the Memory Limit (if your host allows it): Try increasing it to 768M or 1024M by adding this line to your wp-config.php file just above the line that says “That’s all, stop editing!”:
    define( 'WP_MEMORY_LIMIT', '768M' );
    1. Clear WooCommerce Data Caches: Go to WooCommerce → Status → Tools, and run:
      • Clear transients
      • Clear WooCommerce sessions
      • Delete orphaned variations (if applicable)
    2. Temporarily Disable Webhooks: The warning in wc-webhook-functions.php suggests WooCommerce is trying to loop through a null value. If you have webhooks that you’re not using yet, consider disabling or deleting them under WooCommerce → Settings → Advanced → Webhooks.
    3. Database Cleanup: Since the site was cloned, it’s possible some references in your database are outdated. You can use a plugin like WP Migrate Lite to search and replace old URLs or check the wp_options table for legacy values from the original site.

    If the issue persists after trying the above, please share your System Status Report so we can take a closer look. You’ll find it under WooCommerce → Status → Get system report → Copy for support, then paste it into a site like https://pastebin.com/ or https://gist.github.com/ and share the link here.

    Happy to help further once we can review that!

    Thread Starter buildblog

    (@buildblog)

    I cannot get to activate WooCommerce without memory issues.

    I tried :

    define( 'WP_MEMORY_LIMIT', '768M' );

    And also 1024M and 2048M – they all failed. So I cannot activate WC. In order to try the stpes you recommend I need WC activated?

    Thanks.

    Hi @buildblog,

    Thank you for the added clarification and for the steps you’ve already taken. I’ve reviewed your initial message and the error logs you shared, and aside from the memory limit issue, there are a few other important errors worth addressing.

    One of them is a warning that says: “Invalid argument supplied for foreach() in wc-webhook-functions.php on line 176.” This usually points to a broken or improperly configured webhook. Please go to WooCommerce > Settings > Advanced > Webhooks and remove any broken or unused webhooks. For troubleshooting purposes, it’s best to delete all webhooks temporarily. Just make sure to keep a record of any that you remove in case you need to set them up again later.

    Another issue is the “Commands out of sync” database error. This often occurs when multiple overlapping SQL queries are running and exhausting server memory. To resolve this, first ensure all plugins are deactivated and switch your theme to a default one like Storefront. Then, add the following line to your wp-config.php file:

    define('WP_ALLOW_REPAIR', true);

    After that, visit https://yourdomain.com/wp-admin/maint/repair.php and select the “Repair and Optimize Database” option. Once completed, remove that line from your wp-config.php file to secure the site again.

    Next, go to WooCommerce > Status > Tools and clear both types of transients as well as the template cache. Then, check the Logs tab and clear any accumulated logs. Be sure to also look into the Scheduled Actions section and delete any actions that are stuck, pending, or have failed.

    Once all of this is done, activate only WooCommerce and check if the issue still occurs. Let me know what you find, and I’ll be glad to help further if needed.

    Thread Starter buildblog

    (@buildblog)

    Thanks for your reply.

    Unfortunately I cannot activate WC due to the memory issue so I cannot complete some of your recommendations like:

    Please go to WooCommerce > Settings > Advanced > Webhooks and remove any broken or unused webhooks. For troubleshooting purposes, it’s best to delete all webhooks temporarily. Just make sure to keep a record of any that you remove in case you need to set them up again later.

    and

    Next, go to WooCommerce > Status > Tools and clear both types of transients as well as the template cache. Then, check the Logs tab and clear any accumulated logs. Be sure to also look into the Scheduled Actions section and delete any actions that are stuck, pending, or have failed.

    I assume I cannot fix those issues without WC being active?

    Thanks.

    Hi @buildblog,

    Thank you for your feedback and for staying persistent while we work through this. I understand how challenging it is when a critical plugin like WooCommerce won’t activate due to a memory error.

    Just to get a clearer picture, could you let us know when this issue first began? Was it immediately after copying the site, or did it start following a recent update?

    In the meantime, I recommend running a conflict test. If you have access to your hosting file manager or FTP, try renaming the folders of all other plugins (for example, change plugin-name to plugin-name_disabled), leaving only the WooCommerce plugin folder active. If you can access Plugins > Installed Plugins from your WordPress dashboard, you can also deactivate all other plugins there.

    Then, attempt to activate WooCommerce again and check if it runs without hitting the memory limit.

    If it still fails to activate, please confirm your current PHP version. It might help to switch to a different version temporarily (for example, PHP 8.3 or 8.4) to see if that resolves the issue.

    Once you’re able to activate WooCommerce successfully, please share your System Status Report with us. You can find it under WooCommerce → Status → Get system report → Copy for support, then paste it on https://pastebin.com/ or https://gist.github.com/ and send us the link here.

    Let’s see how it goes!

    Plugin Support Feten L. a11n

    (@fetenlakhal)

    Hi there,

    It’s been a little while since we last heard from you, so I’ll mark this as resolved. Reach out anytime if you’d like to revisit this!

    Apart from this, if you’re happy with our plugin and the support you’ve received, we’d really appreciate a review: https://ww.wp.xz.cn/support/plugin/woocommerce/reviews/#new-post

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Fatal error: Allowed memory size’ is closed to new replies.