Support » Plugin: WooCommerce » SKU already exists during import of CSV file

  • Resolved NicheLabs

    (@allennichelabs)


    WordPress 4.9.6
    Woocommerce 3.3.5

    Imported a CSV file with 99 products. When the import finished it reported “Import complete! 95 products imported. 9 products were skipped.”

    I checked the product listing and 95 products were added, but that means that only 4 products that were skipped. So the totals reported are incorrect.

    I compared the list of reported duplicate SKU #s with the CSV import file and only found 4 that were actually duplicates.

    With 100 products this isn’t really an issue but this was just a sample run for a much larger import I’m going to need to do.

    I’ve got 10 files with 1000 product in each and the same thing happens when I try to import one of them.

    Import complete! 979 products imported. 324 products were skipped. Failed to import 1 product. View import log

    Again, this file only contains 1000 records so that means that 21 products were skipped, not 324.

    I spot checked a couple and found the same thing, that several SKU numbers reported as duplicates are not.

    With an import file this large I cannot check each reported case but I need to know what products were actually skipped.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support RK

    (@riaanknoetze)

    Hi there,

    Just to make sure: Are you using the importer functionality that ships with the core WooCommerce plugin or are you one of the CSV import extensions available on https://woocommerce.com?

    Also, asides from the SKUs, did you also check the ID fields? I’m asking as these will need to be unique as well 🙂

    NicheLabs

    (@allennichelabs)

    I am using the import function that comes with Woocommerce. I’m not setting the ID as I thought that was automatically set by Woocommerce. Should I be setting that?

    NicheLabs

    (@allennichelabs)

    I went ahead and added the ID number, starting at 1 incrementing each record by 1 and ran the import again.

    This time it reported 8 records failed:
    Import complete! 95 products imported. 8 products were skipped.

    But again, there were only 99 records in the file.

    This time it reported duplicate ID numbers rather than SKU numbers, but the ID numbers were triple digits. The ID numbers I assigned only go up to 99.

    Alabama Crimson Tide 2×4 Cornhole Board Set – V (w/Bluetooth Speakers), ID 577, SKU P4CSPK-ALA-54 A product with this ID already exists.

    Alabama Crimson Tide College Executive Office Chair, ID 583, SKU P704C-ALA A product with this ID already exists.

    Alabama Crimson Tide Single Cornhole Board – Realtree Max-5<sup>®</sup> Camo, ID 628, SKU P14C-ALA-79 A product with this ID already exists.

    Alabama Crimson Tide Single Cornhole Board – V, ID 631, SKU P14C-ALA-54 A product with this ID already exists.

    Alabama Crimson Tide Stripe Bags- 4pk (A), ID 667, SKU PBB4C-ALA-77-A A product with this ID already exists.

    Alabama Crimson Tide Stripe Bags- 4pk (B), ID 668, SKU PBB4C-ALA-77-B A product with this ID already exists.

    Alaska Anchorage Seawolves Single Cornhole Board – The Edge, ID 698, SKU P14C-AANC-54 A product with this ID already exists.

    Appalachian State Mountaineers 2×4 Cornhole Board Set – Court “A” (w/Bluetooth Speakers), ID 703, SKU P4CSPK-APP-78W A product with this ID already exists.

    Mikey Arce

    (@mikeyarce)

    Automattic Happiness Engineer

    Hi @allennichelabs,

    The most common reason for something like this happening is if you are using IDs on import – because IDs are automatically generated by WordPress and you can’t “assign” an ID that already exists, so I would suggest to not use IDs when you import.

    As for why some products didn’t import, that is a good question!

    What if you try on a brand new site, and import everything again?

    One thing that might be happening is that SKUs also need to be unique – so if you’re importing 2 products that share an SKU it would not import the second one.

    If you’re still stuck, share the CSV in here and we can try it out.

    NicheLabs

    (@allennichelabs)

    I wasn’t adding ID #s until it was mentioned here. I tried adding them to see if that helped, but it didn’t. I can remove them again.

    Some products did not import because the SKU #s are duplicates. That’s understandable and expected.

    The issue is that it is falsely reporting that other products were skipped because of duplicate SKU #s. Those products were actually added, the SKU #’s were not duplicates. The problem is, since I’m dealing with so many products it will be impossible to manually check each item reported to see if it was imported or not. I need to know which ones were actually skipped.

    This is a new site, currently in development. I have a complete backup (programs and database) and I restore the site prior to running an import.

    How can I share the CSV file? I don’t see anywhere that I can upload the file. It currently has a small sample, but that’s still 100 records (when all is said and done I’ll be importing almost 10,000 products).

    I will also mention that this CSV file is one that I’m creating with PHP using fputcsv(). I’m having to read through an existing CSV file and pull out the relevant information and build my own import file. I don’t think that would be the issue because it is importing the products, but thought I’d mention it here in case it’s relevant.

    NicheLabs

    (@allennichelabs)

    I’ve uploaded a copy of the CSV file I’m using here:
    http://nichelabs.com/_files/products_import1%20-%20Copy.csv

    Plugin Support John Coy

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @allennichelabs

    Looks like the issue here is with the formatting of your column headers. Try using the sample CSV provided here (#) and use a spreadsheet editor like Google Sheets as it could be the software use to make the changes could be interfering.

    NicheLabs

    (@allennichelabs)

    I’m not clear on what the issue with the column headers is. I’ve studied the sample data import file prior, during, and after working on this and it’s been very helpful in understanding the various record layouts. It’s actually where I got the headers from. I copied the first line of the CSV file and pasted it into my code.

    As for using a spreadsheet editor, that isn’t possible. As I mentioned previously, I’m creating the CSV import file using PHP and fputcsv(). I basically have a product export file from Shopify and I’m having to create a program to read through that, pull out the information I need, add some additional information (variations) and write it to a CSV import file. The exported file has over 10,000 products. Trying to create the import file using a spreadsheet editor would take thousands of hours.

    For test runs I’m only importing 100 products, but with the attributes I’m still ending up with a file with over 2400 records.

    One thing I did find is that when the export file didn’t have a SKU # associated with it I was trying to use another unique field. I had misread the export file and ended up putting the products title into the SKU field. I have since corrected that.

    Another issue I’m running into is the spinning wheel of death. I’ve added 4 variations to the products and after selecting each option instead of activating the “add to cart” button, the spinning wheel of death appears.

    I’m sure all of this probably has something to do with my import file but I don’t know what at this point. I understand you probably can’t support this too much since it all revolves around custom programming. Unfortunately I don’t have any choice in this.

    NicheLabs

    (@allennichelabs)

    I know this is off topic of this thread but if you are interested or inclined you can view one of the products I’m importing here:
    http://162.144.41.148/~proline/__production/proline_dev/product/alabama-crimson-tide-2×4-cornhole-board-set-skin/

    If the product doesn’t show up it’s probably due to the fact I’ve reset everything and am working on another import.

    If you select a value for all the options you’ll see the “spinning wheel of death”

    I’ve attempted to increase the memory limit but that doesn’t seem to help.

    Plugin Support Kristina

    (@kristinaplauche)

    Automattic Happiness Engineer

    >I’m not clear on what the issue with the column headers is.

    Your CSV file’s headers use capitals, spaces and a couple of question marks.
    The sample CSV John referred to shows the headers as all lower case, no spaces, and no question marks.

    The column headers can cause problems with the import.

    I recommend exporting a product from your site to use as a template for the column header names. Replace those column names in your import file. See if you get the same errors. If you do, then the next step is to temporarily disable all plugins except WooCommerce and import the file again to see if you get the same errors.

    If everything is formatted correctly, you’re right that it’s odd to get the message saying the wrong number of records were skipped.
    Let us know how that works.

    Plugin Support Kenin

    (@kbassart)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘SKU already exists during import of CSV file’ is closed to new replies.