Support » Plugin: WordPress Comments Import & Export » Server 500 Error when WooCommerce isn’t installed

  • Resolved Tommy Ferry

    (@tferry)


    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

    • This topic was modified 1 year, 1 month ago by Tommy Ferry. Reason: code formatting fix
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author webtoffee

    (@webtoffee)

    Hi @tferry,

    Thank you for the valuable feedback and fix suggestion.

    We have fixed the issue and released a new version for the WordPress Comments Import & Export plugin. Please try updating the plugin to the latest version(Ver 2.1.8).

    Thread Starter Tommy Ferry

    (@tferry)

    Thanks so much – it looks like this has solved the problem for me!

    Really appreciate the work (and speed) on adding this update/fix to the plugin.

    Thanks again!
    Tommy

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Server 500 Error when WooCommerce isn’t installed’ is closed to new replies.