Server 500 Error when WooCommerce isn’t installed
-
Hi,
I’m trying to use the plugin to import comments into a site without WooCommerce installed. Unfortunately, this is giving me the following server error:
"GET /blog/wp-content/plugins/comments-import-export-woocommerce/assets/css/admin.css HTTP/1.0" 500
This error only occurs when attempting to import comments – the rest of the plugin screens appear fine.
I believe I’ve traced the issue to this file,
/includes/class-hf_cmt_impexpcsv-admin-screen.php
– line 96:
wp_enqueue_style('woocommerce_admin_styles', $wc_path . '/assets/css/admin.css');
The above line relies on the function
hw_get_wc_path()
(within the same class) to get the WC plugin file path. This causes a 500 error when WC is not installed because the fallback path causes this plugin to try to load/comments-import-export-woocommerce/assets/css/admin.css
, which doesn’t exist.I believe it would be relatively simple to fix this dependency issue with the following condition:
if ( function_exists( 'WC' ) ) { $wc_path = self::hw_get_wc_path(); wp_enqueue_style( 'woocommerce_admin_styles', $wc_path . '/assets/css/admin.css' ); wp_enqueue_script( 'wc-enhanced-select' ); // optional but probably a good idea. }
Let me know what you think.
Thanks,
Tommy
- The topic ‘Server 500 Error when WooCommerce isn’t installed’ is closed to new replies.