To increase the WordPress memory limit for WooCommerce, add define('WP_MEMORY_LIMIT', '256M'); to your wp-config.php file — but the placement matters, since it must sit before the line that loads wp-settings.php or the constant is simply ignored.
Why WooCommerce Needs More Memory
- Large product catalogs, bulk imports, and report generation are memory-intensive tasks
- WordPress’s historic default memory cap (as low as 40M on some setups) is often too small for a busy store
- Memory exhaustion errors can silently break checkout, admin screens, or scheduled tasks
Step 1: Edit wp-config.php
- Connect via FTP or your host’s file manager and open
wp-config.phpin your WordPress root folder - Add the following line:
define( 'WP_MEMORY_LIMIT', '256M' );Placement matters: this line must be added before the line that reads require_once( ABSPATH . 'wp-settings.php' ); — adding it after that point has no effect, since WordPress core has already finished bootstrapping by then.
Raising the Admin-Specific Limit Too
WordPress uses a separate, usually higher, ceiling specifically for admin-side tasks like imports. Add this alongside the line above if admin operations (not the front end) are what’s failing:
define( 'WP_MAX_MEMORY_LIMIT', '512M' );Your Host’s Real Ceiling Still Applies
Setting either constant to a value beyond what your hosting account’s actual PHP memory_limit allows does nothing — WordPress cannot exceed the server’s real cap. If errors persist after raising both constants, the true limit is set at the server level and needs to be raised by your host.
Troubleshooting
Checkout Still Fails After Increasing Memory
Not every checkout error is memory-related. If failures only affect specific orders or gateways (for example, “error processing checkout” while the order still appears in the admin), it’s more likely a plugin or gateway conflict — isolate the cause by disabling all plugins except WooCommerce and re-enabling them one at a time.
Out-of-Memory Errors Persist After Every Fix
If you’ve raised the limit in wp-config.php, php.ini, and .htaccess and still hit the wall, contact your hosting provider directly to confirm the real server-side memory_limit for your account.
Frequently Asked Questions
What memory value should I set?
256M is a reasonable starting point for most WooCommerce stores; larger catalogs or heavy imports may need 512M or more, within whatever your host actually allows.
Is raising the memory limit risky?
No, raising it is safe — you’re simply giving PHP more headroom, not forcing it to use more memory than a given process actually needs.
Do I need to restart anything after editing wp-config.php?
No — PHP re-reads wp-config.php on every request, so the change takes effect on the very next page load.
Conclusion
A single constant in the right spot in wp-config.php is usually enough to increase the WordPress memory limit for WooCommerce and resolve memory-exhaustion errors. If problems continue, look at plugin conflicts or your host’s actual server-side cap rather than raising the number indefinitely.
See also How to Fix the Uploaded File Exceeds the upload_max_filesize Error. Then read How Many Products WooCommerce Can Handle Without Slowing Down.
Prefer no code? All-in-One Utilities is a free plugin, so you can harden and speed up WordPress without code.