1

I have a CSV of products to import and each product has multiple categories, some with commas in the category name. To import a product and asign multiple categories, I would usually add a CSV column for _catagory and give a comma separated list of categories enclosed with double quotes:

sku,name,_category
1,Product 1,"Category 1,Category 2, Category 3"

However, if the category names have commas in them, how should I denote this in the CSV?

  • Category, 1
  • Category, 2
  • Category, 3

Perhaps escape the comma in the category name?

sku,name, _category
1,Product 1,"Category\, 1,Category\, 2, Category\, 3"

Or perhaps the only way to do this is to use the category ID rather than the name?

3 Answers 3

2

This is not how you import multiple categories. The correct way is to add a new line but without sku:

sku,name,_category
1,Product 1,Category1
,,Category2
,,Category3

As long as there is no new SKU, all lines belong to the same product.

3
  • I'm not really familiar with the old dataflow import, I thought you were refereeing to the new import/export because the dataflow is deprecated since version 1.5. See this answer.
    – Domeglic
    May 10, 2015 at 6:36
  • Thanks @Domeglic for your reply. I applied your instruction but it produces error.
    – abu abu
    Jun 12, 2017 at 5:07
0

In Magento 2+, there is the field called Multiple value separator and Fields enclosure. If your category name contains comma(,) then Multiple value separator should be having the value of " and Fields enclosure should be enabled for the following scenarios:

"Default Category/test11/test12, test13/test14 & test15"

Then Magento creates the structure as follows,

+Default Category
++test11
+++test12, test13
++++test14 & test15
1
0

Both respondents misunderstood the question. The solution is here: Magento 2 csv product import : How to escape commas in category name

You have to change the Multiple value separator from comma (,) to something else like pipe (|) in the CSV and also in the settings at Import page in Magento. See the attached images below:

enter image description here

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.