• Resolved vision-hive

    (@vision-hive)


    It’s the type that the same plugin exported, so clearly a bug…

    Details: WooCommerce 3.5.3 export from production, import to identical installation on development.

    Error message: “Invalid file type. The importer supports CSV and TXT file formats.”

    Renamed to .txt and get the same error.

    WooCommerce export/import fail!

Viewing 14 replies - 1 through 14 (of 14 total)
  • Zach W

    (@dynamiczach)

    Automattic Happiness Engineer

    Howdy!

    That issue popped up in 3.4.6, but should be addressed if you’re using 3.5.3. Is your WooCommerce database updated (you can check by going to WooCommerce > Status and looking for your WooCommerce Database version). If not, please update that to 3.5.3 to see if that resolves the issue.

    Also, what version of WordPress are you using?

    If you don’t want to update, the check can be easily disabled by adding this snippet:

    add_filter( 'woocommerce_product_csv_importer_check_import_file_path', '__return_false' );

    More info here: https://github.com/woocommerce/woocommerce/issues/21548#issuecomment-429638517

    Thread Starter vision-hive

    (@vision-hive)

    WP version is 4.9.9. No, upgrading to 5 is not an option.

    The WC db is the latest version 3.5.3.

    Thanks for the filter but the file check is important, we’ll wait for a fix.

    Zach W

    (@dynamiczach)

    Automattic Happiness Engineer

    Howdy!

    Thanks for the filter but the file check is important, we’ll wait for a fix.

    The fix has been added in WordPress core already, you would need to update to the latest version to have it resolved.

    If you aren’t going to update to WP 5.0.3, I’d recommend implementing the filter, then importing, then removing the filter.

    Hi,

    I have the same problem since to WordPress 4.9.9. I can’t import CSV files into Woocommerce
    I updated WordPress to 5.0.3 and it’s the same
    I added the code below and it’s the same
    add_filter( 'woocommerce_product_csv_importer_check_import_file_path', '__return_false' );

    for info, I’m under Woocommerce 3.5.4 et WordPress 5.0.3.

    Where is the problem ?

    Thanks !

    • This reply was modified 5 years, 8 months ago by arnlig3550.
    • This reply was modified 5 years, 8 months ago by arnlig3550.
    Zach W

    (@dynamiczach)

    Automattic Happiness Engineer

    Howdy!

    Can you check to make sure your import file is correct?

    https://github.com/woocommerce/woocommerce/issues/22400

    If it is, you can try installing and activating this plugin before importing:

    https://wordpress.org/plugins/disable-real-mime-check/

    I’d recommend only keeping that plugin activated while you need to import, then deactivating it when the import is done.

    Hi,

    Thank you for your reply.

    – I export my Woocommerce products then imported the same file but it doesn’t work either.
    – I tried the code to put in function.php quoted in your 1st link, but it breaks my site (error 500) !
    – I would like to avoid installing a plugin for this …

    Do you know if a real update will solve the problem?

    Thanks !

    Zach W

    (@dynamiczach)

    Automattic Happiness Engineer

    Howdy!

    Thanks for that info!

    The code I gave in my first response isn’t needed anymore, as you should have no problems importing CSV files to your site with the latest version of WooCommerce and WordPress.

    What I _think_ may be happening here is that the CSV file type was rejected due to the bug in WordPress 5.0, and even though it is fixed now, the CSV file type may still be listed on restricted MIME types for your site.

    I would recommend trying one of the following plugins to check which mime types are allowed and restricted on your site, and if CSV is being restricted.

    * https://wordpress.org/plugins/all-mime-type-options/
    * https://wordpress.org/plugins/wp-add-mime-types/

    If you’re unable to access that information, I would recommend contacting your hosting provider and having them make sure the CSV mime type isn’t being restricted in any way.

    I hope this helps!

    My hosting provider is not involved because the CSV file import worked with WordPress 4.9.8.

    I didn’t want to use a plugin to work around this problem, but I think I have no choice …?

    When will this problem be fixed ?

    Thanks

    Zach W

    (@dynamiczach)

    Automattic Happiness Engineer

    Howdy @arnlig3550!

    I don’t think you’re quite understanding what I’m asking you to do. You need to check to see if CSV files are on the restricted mime types for your site, then remove them if they are.

    I know this worked previously, but with the bug in WordPress core it is possible that the CSV file was added to the restricted file list.

    Can you please try installing one of the plugins and checking for that? Even though the issue is resolved now, you’ll want to check to make sure CSV files aren’t on the restricted list.

    I installed WP Add Mime Types

    Here is the list of allowed mime types and file extensions by WordPress

    jpg|jpeg|jpe	=	image/jpeg
    png	=	image/png
    gif	=	image/gif
    mov|qt	=	video/quicktime
    avi	=	video/avi
    mpeg|mpg|mpe	=	video/mpeg
    3gp|3gpp	=	video/3gpp
    3g2|3gp2	=	video/3gpp2
    mid|midi	=	audio/midi
    pdf	=	application/pdf
    doc	=	application/msword
    docx	=	application/vnd.openxmlformats-officedocument.wordprocessingml.document
    docm	=	application/vnd.ms-word.document.macroEnabled.12
    pot|pps|ppt	=	application/vnd.ms-powerpoint
    pptx	=	application/vnd.openxmlformats-officedocument.presentationml.presentation
    pptm	=	application/vnd.ms-powerpoint.presentation.macroEnabled.12
    odt	=	application/vnd.oasis.opendocument.text
    ppsx	=	application/vnd.openxmlformats-officedocument.presentationml.slideshow
    ppsm	=	application/vnd.ms-powerpoint.slideshow.macroEnabled.12
    xla|xls|xlt|xlw	=	application/vnd.ms-excel
    xlsx	=	application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
    xlsm	=	application/vnd.ms-excel.sheet.macroEnabled.12
    xlsb	=	application/vnd.ms-excel.sheet.binary.macroEnabled.12
    key	=	application/vnd.apple.keynote
    mp3|m4a|m4b	=	audio/mpeg
    ogg|oga	=	audio/ogg
    wma	=	audio/x-ms-wma
    wav	=	audio/wav
    mp4|m4v	=	video/mp4
    webm	=	video/webm
    ogv	=	video/ogg
    wmv	=	video/x-ms-wmv
    flv	=	video/x-flv
    ttf	=	font/ttf
    otf	=	font/otf
    woff	=	font/woff
    woff2	=	font/woff2
    Zach W

    (@dynamiczach)

    Automattic Happiness Engineer

    Thanks!

    Looks like CSV isn’t an allowed type.

    You’ll need to add it back to the list and this plugin should help with that:

    https://wordpress.org/plugins/wp-add-mime-types/

    Then you shouldn’t need any other plugin or code for it to work again. 🙂

    Perfect it works! 🙂

    Can I now uninstall the plugin or do I have to keep it ?

    Thanks !

    Zach W

    (@dynamiczach)

    Automattic Happiness Engineer

    Happy to hear that! 🙂

    You should be able to uninstall the plugin.

    Ok thanks ! 🙂

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Export/Import fails “Invalid file type”’ is closed to new replies.