• Resolved mattnewark

    (@mattnewark)


    Hello,

    I’m looking for a little bit of guidance, I am trying to upload a load of products using the import option for the new Woo 3 and it keeps coming back saying that the below:
    T/LIGHTX12 VANILLA&BROWN SUGAR, ID 4261, SKU 680000 Invalid or duplicated SKU.

    I have checked the DB and I am unable to see one with that ID and when I have cleared out all the products and try again the variations are uploaded but the variable of the variations are not so do not show up.

    The CSV that I am uploading are in CSV utf-8 and the template I am using is from the export of products so that I could get all the table column names.

    I really need to get the products upload as I will have 100’s when I get it working, could someone please point me in the right direction?

    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • I’ve been using the importer quite a bit the last couple of months – over 500 products in a single site that had to be updated and more added.

    To clarify, there are 2 importers. 1 is the “built-in” importer that’s now part of WooCommerce. The other importer is the CSV Import Suite which was (still is I think) sold by WooCommerce, but for a deep discount because they are going to abandon that importer.

    I “much” prefer the paid importer. I’ve had nothing but problems trying to use the “built-in” importer and finally gave up and went back to the other. I’m trying to make the switch to the “built-in” since the other will not be supported for long.
    Using the CSV Import Suite, there are 2 types of import – Import and Merge.
    If you have had products in your database, the chances are that whatever you did to delete them (unless you deleted “all” data pertaining to products via the database) nothing in WooCommerce is actually going to delete your products and variations.

    There are “Tools” in WooCommerce that specifically are for deleting products, variations, etc. But that only deletes them from your admin – not the database. And, because there are so many places that the meta information, variations, etc., are found, there is no way to go through the database and find all the “transients”, which may or may not be deleted using the “Tools” – I don’t know. I gave up trying to delete anything with the WC Tools.

    When you import using the built-in importer, I found a lot of products that show “Product already exists” or “Duplicate ???”, and that’s because “some” information is already in the database and for whatever reason the built-in importer refuses to “update” or “merge” the new information. That is when the importer “should” merge the information. But I found that the built-in importer simply doesn’t work as well to merge information. It won’t “create” new products from import either.

    And all I’ve had from WooCommerce is the support from “Automatic Happiness” (oxymoron) who don’t know enough to provide support…and you can’t get to the technicians who can provide support – at least “I” have been unable to get them to respond.

    When you say “…cleared out…”, did you delete from within admin? Or did you run an SQL query to delete them?
    Did you attempt a “merge” by checking the “Update existing products” with the built-in importer? Even when I did, the import still didn’t import all the data.

    Quite frankly, I don’t see the value in the “built-in” importer. That importer REQUIRED me to have the hosting company increase the memory – a LOT – in order to import that 1 very large file. Even the export requires more memory. That as opposed to the paid importer that does not need the additional memory and works great…because it was developed outside of WooCommerce.

    If you can create a ticket with WooCommerce that would be best. However, I ended up going through GitHub because WooCommerce wouldn’t allow me to create a ticket.

    Can you tell I’m really, really frustrated with the WooCommerce importer and the customer service?

    I just finished reading about All Import -wpallimport.com – and find that the software would be faster, easier and much less problematic. Additionally, if you make a mistake in import, you can go back to where you adjust the mistake, fix the mistake and reimport – as many times as you need.

    There’s not enough info to respond – although I suspect if someone had any idea they’d tell you what they need. I’ll take a stab at it since I’ve been playing with the built-in CSV importer; though no exports.

    Anyone trying to help you would need to see a copy of the data file you’re using. Three things I’d be looking for. The first is that the header is formatted properly. The second is that the specific product row in question is properly formatted and if that didn’t produce any results – then finally I’d scan the entire file, starting at the line it choked on “T/LIGHTX12 VANILLA&BROWN SUGAR, ID 4261, SKU 680000 Invalid or duplicated SKU.”, and working backwards (and a bit forwards too perhaps) until I found something. Is that a valid row in your data or is it a partial? I’d also import into a spreadsheet and verify the data that way as well.

    There’s nothing wrong with the importer itself that I’ve found – it’s always the data.

    So what would I be looking for? Commas and quotes mostly but also apostrophes. It’s a file of Comma Separated Values – so if there is a comma in the data itself rather than used as a delimiter, the importer will get confused. The solution is to put double quotes around each field data value. So for example:
    This is field 1 it has neither commas nor is it protected by double quotes., “This is field 2, it has a comma in it and is surrounded by quotes.”, “This is field 3. It has no commas, but is protected by double quotes.” Single quotes can also be used, but if the data has single quotes in it, then the importer could get confused if the quotes aren’t escaped with a backslash – or double quotes. ‘I\’m a sentence with an apostrophe’

    It can’t hurt to put quotes around each field if you’re not sure or just want to be safe.

    One last item of note. When you import, you have a checkbox you can check as to whether you want to update products or import new ones. It can’t do both at once so you have to feed it two different files – one with new products and one with only updates. Read what it says carefully, better yet – experiment.

    Thread Starter mattnewark

    (@mattnewark)

    Hi @apb1963,

    Thanks for the update, when I try and upload the file now I get a error on the images.

    
    Error getting remote image https://79.170.40.180/regtaylors.co.uk/wp-content/uploads/2017/09/760324.jpg. Error: cURL error 56: Failure when receiving data from the peer.
    

    I have checked and confirmed that the image is in media and that I am able to see it.

    Have you come across this before?

    See if https works. Note the ‘s’ at the end.

    Thread Starter mattnewark

    (@mattnewark)

    Hi apb1963,

    I have changed the url to include https and this did not work, the only thing I can think of is to remove woocommerce and see that helps. It has been working but all of a sudden stopped.

    If you can think of anything else please let me know..

    sun

    (@tha_sun)

    To prevent the error “Invalid or duplicated SKU.” in the WooCommerce product import disable the mapping for the field “ID” by setting it to “Do not import” in the field mapping form of the 2nd step in the WooCommerce product import.

    By attempting to import and map the (post) ID of your products by default, WooCommerce assumes that the database you’re exporting from and the database you’re importing into were the same databases at some point — which is most probably not the case in your case (and in 99% of all cases).

    In order for the import to work without IDs, all of your products need to have a SKU. The WooCommerce product import falls back to using the SKUs of the products to map e.g. variations to their parent variable products.

    Also, all of your SKUs need to be unique. SKUs of variations need to differ from their parents. To double-check that your product data is actually correct, execute the following database queries and ensure that they do not produce any results:

    
    -- Most basic check within postmeta (must pass)
    SELECT COUNT(p.ID) AS count, p.post_title 
    FROM wp_posts p 
    INNER JOIN wp_postmeta pm ON pm.post_id = p.ID AND pm.meta_key = '_sku' 
    GROUP BY pm.meta_value 
    HAVING count > 1;
    
    -- More granular results with actual product IDs to check
    SELECT p.ID, sku.meta_value AS sku, p.post_title, p.post_type 
    FROM wp_posts p 
    INNER JOIN wp_postmeta sku ON sku.post_id = p.ID AND sku.meta_key = '_sku' 
    INNER JOIN wp_postmeta dupe ON dupe.post_id <> sku.post_id AND dupe.meta_key = '_sku' 
    WHERE dupe.meta_value = sku.meta_value 
    GROUP BY p.ID;
    

    Also make sure to use the action “Remove orphan product variations from database” in the Tools screen of the WooCommerce Settings page. The action has been introduced in a recent version and removes product variations whose parent variable products no longer exist in the database, but which still exist for unknown reasons (invisibly) in the database and cannot be seen or reached through the backend user interface.

    i dont see the option were you can select remove orphan product

    Looks like they moved it to Woocommerce > Status > Tools tab

    https://stackoverflow.com/questions/46244572/woocommerce-deleted-products-variations-remain

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Woocommerce Product import’ is closed to new replies.