• Resolved Alta

    (@shellardee)


    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
    1
    2
    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 a11n

    (@spraveenitpro)

    Automattic Happiness Engineer

    Hi@shellardee,

    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,

    https://en.wikipedia.org/wiki/Comma-separated_values

    Cheers

    Thread Starter Alta

    (@shellardee)

    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

    (@shellardee)

    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 ) {

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

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

    Now, my categories can contain commas.

    ??

    Joel Williams

    (@joelwills)

    Automattic Happiness Engineer

    Hi there!

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

    https://github.com/woocommerce/woocommerce/issues

    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.

    Thanks!

    Plugin Support Hannah S.L.

    (@fernashes)

    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 (https://github.com/woocommerce/woocommerce/issues/18635) commas in the CSV should be escaped => prefix them with a backslash => \,
    Hope this helps.
    Cheers,
    Guido

    Thread Starter Alta

    (@shellardee)

    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.