• Resolved studiophg

    (@studiophg)


    I have 1000 items that I can’t find on the site, but that can’t be loaded to the site because the importer thinks that they are already on the site.

    What I’ve done so far:

    I had a 12000 product spreadsheet which I uploaded in multiple passes due to progression freezes.

    Then I imported the spreadsheet through again but this time in product update only mode. This generated an import log listing some 1700 items it said could not be updated as the SKU don’t exist on the site. I performed searches to confirm that the item could not be found on the site.

    I then created a new spreadsheet with only the items missings from the website and imported that. I was surprised to see that the next report states that 1000 items could not be added as the SKU already exist on the website. I have checked again and can’t find any matching items on the site.

    Can anyone make sense of this and offer a solution please?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Luca

    (@screenload)

    Hey, try to look for it in the database directly.

    Open a connection to the SQL-Database and run following command:

    SELECT * FROM 'wp_postmeta' WHERE '_sku' = 'REPLACE-WITH-A-SKU'

    REPLACE-WITH-A-SKU = an example SKU from the 1000 products

    If a line is shown, there is probably some leftover data. In this case you need a plugin to clean up the database!

    • This reply was modified 6 years, 7 months ago by Luca.
    Thread Starter studiophg

    (@studiophg)

    thanks for your help.

    I wasn’t able to run your script succesfully, I got the following error:

    #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ”wp_postmeta’ WHERE ‘_sku’ = ‘4501’ LIMIT 0, 30′ at line 1
    SELECT *
    FROM ‘wp_postmeta’
    WHERE ‘_sku’ = ‘4501’
    LIMIT 0 , 30

    So I continued with cleaning the database clean idea.

    I ran ‘optimize tables’ within PHPMyAdmin, attempted product import but got the same error.

    I downloaded WP-Optimizer and optimized everything, but got the same ‘SKU already exists’ error when I ran the importer.

    Don’t sure what to try next

    Luca

    (@screenload)

    Wow, what was I thinking, the SQL-query is garbage ??
    Try this one instead:

    SELECT * FROM wp_postmeta WHERE meta_key LIKE '_sku' AND meta_value LIKE 'REPLACE-WITH-A-SKU'

    REPLACE-WITH-A-SKU = an example SKU from the 1000 products

    And for the cleanup I would try this one, as it removes orphaned reference data:
    https://de.www.ads-software.com/plugins/advanced-database-cleaner/

    Anyways, you should check the passes for any redundant data

    Thread Starter studiophg

    (@studiophg)

    that new code did the trick, I got a return on my first attempt.

    I have installed the suggested plugin and run the clean but the product import didn’t work for me.

    I notice the premium version has a feature called clean ‘Detect orphan tables’, do you think I need the premium version to get the job done?

    Luca

    (@screenload)

    Hmmm… deleting the orphan tables is basically what you need to to.
    I think a premium plugin is not necessary here, I heard this could do this, too:
    https://www.ads-software.com/plugins/wp-optimize/

    Just tested it, worked for me, hope it does for you as well!

    • This reply was modified 6 years, 7 months ago by Luca. Reason: tested it
    Thread Starter studiophg

    (@studiophg)

    WP optimizer was the first plugin i tried but i will look again for that feature

    Luca

    (@screenload)

    Just make sure to tick all boxes ??

    Thread Starter studiophg

    (@studiophg)

    alas thats what i did first time. Just tried again on the orphaned optimisations and got this return.

    Clean post meta data 0 orphaned post meta data deleted

    Clean comment meta data 0 unused comment metadata items removed
    0 unused akismet comment metadata items removed

    Clean orphaned relationship data 0 orphaned meta data deleted

    Thread Starter studiophg

    (@studiophg)

    is there a way i can safety manually edit the table and remove the unwanted data?

    Thread Starter studiophg

    (@studiophg)

    just tried the premium version of advanced db cleaner, it found one orphan table which I deleted but it hasn’t fixed it.

    What I think is happening is that the SKU data in one of the table is orphan but these plugins are only looking for completely orphan tables.

    • This reply was modified 6 years, 7 months ago by studiophg.

    Maybe you’ve done it but did you try running the “Delete orphaned variations” tool at
    Dashboard > WooCommerce > Status > Tools tab

    Thread Starter studiophg

    (@studiophg)

    Thanks for the suggestion, sounded promising but I got the following message after clicking delete opened variations.

    0 orphaned variations deleted

    Thread Starter studiophg

    (@studiophg)

    bump – all ideas welcome

    Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @studiophg,

    You can get with your host to see what PHP errors are logged after an import attempt, this could tell you more about why the errors are showing. Secondly, if the current content isn’t important you may want to consider removing all WooCommerce data or trying on a new install.

    Here is a link to wipe WC data after deleting the plugin: https://docs.woocommerce.com/document/installing-uninstalling-woocommerce/#section-4

    Don’t forget to remove the line from the wp-config file so the data isn’t wiped in future deactivations.

    Thread Starter studiophg

    (@studiophg)

    I did try on a new install wordpress site with a different theme and it worked.

    I’m using a staging platform but would still be unsure how much data i would use if I remove woo completely and replace it fresh, bit scared to honest.

    Alas, I think I’m at a point now that I must get in outside help.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘‘Sku already exists’ but there no matching SKU on site’ is closed to new replies.