Support » Plugin: WooCommerce » Product Import with Categories

  • Resolved Alta


    Product Import with Categories Messes up commas in category.
    We have categories with commas and when it’s imported via csv file, the categories are split up if they have a comma.
    E.g., I have a category
    1, 2, and 3
    Well, that imports as 3 separate categories
    and 3

    How do I structure the csv file if the category name has a comma?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Praveen


    Automattic Happiness Engineer


    CSV stands for comma separated values, so when you are entering data in the csv format, you are telling the computer that comma will be used as a separation identifier between two values. I would recommend not using the comma in the category name as that will break the word into two. In case you still would like to import then after importing you could manually have it edited,


    Thread Starter Alta


    Hi Happiness Engineer,
    Thank you for the quick reply.

    In csv files, the fields containing commas is quoted. Thus, you cannot simply consider all commas delimit the fields in the row. The commas within the quotes should not separate into individual fields, but be retained.

    I’ve never had issues importing csv files. Look at phpMyAdmin – I import csv files all the time with no problem, not only in phpMyAdmin but also reading csv files in php.

    So, having commas within a field in a csv file should be no problem.
    Perhaps contact your software programmers to reconsider this issue.

    Thank you. So far, Woocommerce seems to work smoothly and I will continue to use and promote it.

    Thread Starter Alta


    I found the error in the program. Can you ensure that this fix is included with the next upgrade so that my mod doesn’t get overwritten with the original code?

    The category is split at the commas, not >
    So, in class-wc-product-csv-importer.php
    public function parse_categories_field( $value ) {

    $row_terms = $this->explode_values( $value );
    $row_terms = explode(“>”,$value);

    They may clean it up in case people use ” > ” instead of “>”.

    Now, my categories can contain commas.


    Plugin Support Joel Williams


    Automattic Happiness Engineer

    Hi there!

    If you believe this is a bug with WooCommerce you can report it here:

    With all the details on the issue and how to replicate it. Then they can look into it further for you. You may wish to try the beta of WooCommerce 3.3.0 that will be released soon to see if the issue has already been fixed.


    Plugin Support Hannah S. a11n


    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.

    As pointed in a Github issue ( commas in the CSV should be escaped => prefix them with a backslash => \,
    Hope this helps.

    Thread Starter Alta


    Guido, Months later we get a response. Sorry, I already found another solution to use that is not your plugin. Good luck with your business, Guido.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Product Import with Categories’ is closed to new replies.