• Resolved Chad Reitsma

    (@chadreitsma)


    When I IMPORT a CSV with meta fields they are not overwritten, instead they are duplicated in the postmeta table with a lower-case key.

    This doesn’t seem right…

    HEADER FIELD IN CSV: meta:_regular_price_CAD
    BECOMES: _regular_price_cad in the postmeta table, and the correct header field (with upper-case CAD) is not updated.

    Anyone else have this problem?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Phil

    (@fullysupportedphil)

    Automattic Happiness Engineer

    @chadreitsma the meta_key information on the wp_postmeta table will be stored as lowercase, that’s normal.

    If you are trying to update existing products, in your CSV field make the changes you want to the heading for the metadata column as well the value for each individual product. Make sure that you don’t have duplicate columns in your CSV for this metadata.

    When you import a csv to update your existing products, if you remove a metadata column from your CSV that metadata will no longer be tied to the product.

    In your example if you removed the meta:_regular_price_CAD column from your CSV, after import that meta_key would no longer exist on your product. So you aren’t really “updating” information, so much as you are replacing.

    You shouldn’t end up with duplicate results columns in your database. Does this happen to you on a fresh WordPress/WooCommerce installation that is using the Twenty Nineteen theme and no other plugins?

    Thread Starter Chad Reitsma

    (@chadreitsma)

    Hi Phil, no – meta keys can be whatever you want. The plugin we use stores it’s keys like this: _price_CAD and has no problem with it.

    The export file contains this in correct format, but after it is imported there is another key created with the lowercase version. So is it applying strtolower somewhere? I couldn’t find it… Maybe there’s a filter messing it up. IDK, I ended up just writing my own script to process an excel sheet.

    Phil

    (@fullysupportedphil)

    Automattic Happiness Engineer

    Sorry for the confusion with what I meant @chadreitsma.

    Yes you can label your fields however you want. The default for WooCommerce though is to use lowercase, that is what I meant. So when you import your file, WooCommerce will be converting it to lowercase.

    If the third-party plugin you are using is overriding that, it would explain why you are getting the duplication. As it would maintain the mixed case heading, while the file import you do in WooCommerce uses lowercase.

    I’m glad to hear that you were about to work around this to find a solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘CSV Import doesn’t overwrite meta_key + meta_value’ is closed to new replies.