• Resolved nuttwicrew

    (@nuttwicrew)


    Woocommerce 3.4.6 cannot import products in Wamp Server on Windows

    Show error message : Invalid file type. The importer supports CSV and TXT file formats.

    I investigated in wc plugin and found this method.

    public static function is_file_valid_csv( $file, $check_path = true ) {
        if ( $check_path && apply_filters( 'woocommerce_product_csv_importer_check_import_file_path', true ) && 0 !== stripos( $file, ABSPATH ) ) {
            return false;
        }
    
        $valid_filetypes = self::get_valid_csv_filetypes();
        $filetype = wp_check_filetype( $file, $valid_filetypes );
        if ( in_array( $filetype['type'], $valid_filetypes, true ) ) {
            return true;
        }
    
        return false;
    }

    I think this condition make a error.

    0 !== stripos( $file, ABSPATH )

    $file = “C:/wamp64/www/test.local/wp-content/uploads/2018/10/products_all_gg-1.csv”
    ABSPATH = “C:\wamp64\www\test.local/

    make a condition = false

    Fixed issue during new update.
    Add code below to functions.php
    add_filter( 'woocommerce_product_csv_importer_check_import_file_path', '__return_false' );

    please fix this issue

    Thanks!

    • This topic was modified 6 years, 1 month ago by nuttwicrew.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Woocommerce 3.4.6 cannot import products in Wamp Server on Windows’ is closed to new replies.