Importing WooCommerce products is slow
Problem
Importing products in bulk, for example, using WooCommerce's CSV importer, is slow when WP Rocket is activated
This can also happen when importing data into other content types with a plugin like WP All Import, or similar.
Cause
When the content on your site is updated, WP Rocket will perform some cache purging. So if you import a lot of data that triggers posts/products etc. to be updated, the cache purging will be triggered frequently. Additionally, if you have enabled preloading, this will also be triggered.
This can lead to slowness, causing the import to take longer.
Solutions
- Programmatically using a filter
You can prevent automatic cache purging when there is an ongoing importing process.
To achieve this, the following filter can be integrated into the importing code:
add_filter( 'rocket_is_importing', '__return_true' );
- Deactivating the automatic cache purging
Alternatively, using a helper plugin, the automatic cache purging can be disabled.