Bug with importing variable products via .csv
-
Hello, I am having an issue with with importing variable products via .csv.
I’m using the latest WooCommerce and WordPress versions.
What I did:
1. I manually uploaded a product with variations to my site.2. I exported this product in a .csv sheet.
3. I filled in the sheet with a new product, exactly as per the example of the exported product.
4. I imported the .csv into my site.
5. The new product was imported, however the variations – not.
6. I even tried importing the exported product sheet into a new site – and it didn’t work, even if the product I exported works just fine.
I can send a link to the sheet so you can see and test it out.
From what I can see, this issue has been reported numerous times since 2018 in GitHub.
Thanks in advance.
-
Hello mstudioeu
Thank you for contacting Woo support.
The best way to resolve this issue will be by sharing the CSV file you imported.
I will have a look at it and check for any misconfigurations.
Then I will test it on my dev site and see how it works.Looking forward to your response. ??
Best regards.
Hi, sure, please check the CSV file here:
https://docs.google.com/spreadsheets/d/11l8Gz5cXedrdc2JENbl7njP6hVgXCMSYhXkynnGq1Ug/edit?usp=sharing
Hello mstudioeu
Thank you for sharing the CSV file.
I checked the file and noticed some strange characters.
Do these characters mean something to you?
Here is a screenshot:Also, note that Variable is the main product (T-Shirt) and variations are the child (T-Shirt Red).
So each Variation should have a parent.
Here is an example screenshot for your reference.I recommend that you look into the sample-data directory found inside the WooCommerce plugin directory. You will find a few CSV examples.
Le tme know if you have any questions. ??
Best regards.
Hey there Zubair,
Thanks so much for your time, I really appreciate it!
Can I ask you where exactly you see these characters?
As to the table, please check the original exported table from WooCoommerce – there is a parent column for each variation but it’s still not working.
https://docs.google.com/spreadsheets/d/1t0rBTiEYFe33NYDOieqJ5SBGPgI0CWI8aaYwkZaHBdM/edit?usp=sharing
Hi there @mstudioeu
I’d like to zoom out for a moment, and loop back to the following part of the original message here:
1. I manually uploaded a product with variations to my site.
From what I gather, the product was uploaded, not created. Correct?
If so, best to start looking for answers there first.
I trust that points you in the right direction, but if you have more questions, let us know.
We’re happy to help.
From what I gather, the product was uploaded, not created. Correct?
Well, yes, that’s the problem I was originally reported in the first place.
I am not entirely sure what you mean. The product was first created by me. I ensured it was working okay, so I exported it in a .csv so I can use it as a guide and upload more products like that via the table.
Can you please check the table and let me know if it works on your end?
Hi @mstudioeu,
This reminds me of a thread from a few months ago, may I ask, have you tried creating the attributes you’ll use for your variations before importing? My reply linked before may provide more insights into this and how to proceed.
Kindly let us know if the proposed method works for you.
Thanks!
-OPYes, I can confirm that the both attributes are already created before importing the products from the file.
Please let me know if you have any further suggestions.
Hi @mstudioeu
It seems like the issue might be related to how the CSV file is formatted or how the data is structured.
I tried importing products from your CSV file, but they all imported as simple products. The attributes, however, were imported correctly. When I tested our sample CSV file, all the products were imported just as they were set up in the CSV file.
However, I exported some variable products from one of my testing sites. Could you please import them into your site and see if they’re working correctly? Here’s the CSV file for you to download: https://www.boxpuff.com/3tq/wc-product-export-17-7-2024-1721185653903.csv
Let us know how that goes. Looking forward to helping you.
Hey again, thanks for your time and dedication to solving the issue!
I checked your sample table and it’s indeed different from mine (which was generated by exporting a manually created variable product on my site) – in your table all product variations are in the same line, while in my sheet the “main” product is on one line, called “variable”, and the separate variations are listed in new lines and called “variations”:If I use the sheet above, how can I set different prices for each variation? How can I also set different SKUs for each variation? Both are very important for my client. In your example the variations concern an item’s colour and size, which likely don’t involve any pricing change, however in the sheet I am testing with I am trying to import different print sizes and each print size has a different price.
Ultimately, could this be because of the symbols – Cyrillic instead of standard latin characters?
Thanks in advance!
Hi @mstudioeu
how can I set different prices for each variation? How can I also set different SKUs for each variation? Both are very important for my client.
In WooCommerce, each variation should be on a separate line with its own SKU and price. The parent product (the “variable” product) should also have its own line, but it doesn’t need a price or SKU.
I suggest you try to restructure your CSV file to match the format of the sample CSV file I shared and see if that resolves the issue.
Ultimately, could this be because of the symbols – Cyrillic instead of standard latin characters?
WooCommerce should be able to handle non-Latin characters without any issues, but it’s always a good idea to test it out.
Can you also tell me what text you’ve added to the column head? Remember, you should avoid adding any text there because it is used to map with a product property. More info: https://github.com/woocommerce/woocommerce/wiki/Product-CSV-Import-Schema
I hope this provides some clarity. Please let us know if you have any other questions!
Hey again!
In WooCommerce, each variation should be on a separate line with its own SKU and price. The parent product (the “variable” product) should also have its own line, but it doesn’t need a price or SKU.
Yes, this is what I did in my original sheet.
I removed the extra text from the column head, however it still doesn’t work. The product is imported as a variable product, but still out of stock and in the variations tab it shows empty. When I head over to attributes, it shows none of them are selected to be used “for variation”. Can you please check the sheet, I am not sure what I may have done wrong?
Video:
I think the bug is the table doesn’t recognise the attributes added are meant to be used for variations.
Reattaching the sheet, please let me know if you need editing rights:
Hey, @mstudioeu!
Thanks for the video!
I ran some tests with the csv file you shared and I was able to replicate the issue by importing it exactly as it is. The product was created, but the variations were not.
I was able to import the variations when I either:
- Changed the “is attribute global?” to 0: This way it did create local attributes and the variations
OR
- Changed the attributes to ones I had already set as global attributes on my website: This way, with “is attribute global?” set to 1, it did import the variations correctly
I see you mentioned you had already created the global attributes, right?
But it seems there’s something wrong with it.Can you please check and make sure the spelling is correct on both the Attributes page and the CSV file?
You can also try deleting them and adding them again to see if it works.Please let us know how it goes.
—
On your video, I see your database is outdated. This can cause a lot of issues on the website.
Please update it by either following the warning message a the top of the page on WooCommerce area of the dashboard or going to WooCommerce > Status > Tools > Update Database.
Be sure you have a good backup in place of your full site and database. You can ask your host for backup functionality or you can consider using a service like Jetpack. If something goes wrong, you will be able to restore it.
Have a wonderful day!
I have tried all your suggestions – the database is updated, I have tried with “is attribute global?” 0 and 1. I also tried to create a new attributes with the same name and it said that the attribute already exists, so I’m positive they are correctly added in the backend.
I still can see that the attributes are not marked as Used for variations whatever I try with the table….
Can you please show in a video your way with the same file? Thanks in advance.
Hey, @mstudioeu!
I’m so sorry, I forgot to add another step I did. Besides changing the attributes, I also changed the info you added to the Parent column.
As you can see, there’s a space between the colon and the number, I removed it.
I was only able to get it working when I both removed this space and made the changes I mentioned on my last message. Can you please try doing both and checking?
Here are the videos of me doing it on my site:
Direct link to video: https://www.loom.com/share/1e7828d2faf3403b9a5f51b3b60cb607?sid=7498f0b1-6102-41be-9a7b-9b018d644bd6
On this one, I switched the “is attribute global” to 0.
Direct link: https://www.loom.com/share/bef93fa9cb734ffc9b43613e441c8a5f?sid=f0c4ad68-3bb2-4e72-8d11-2a8afcf8c32d
On this one I used 2 global attributes I already had on my website.
Can you please try it like this and let us know if it worked?
Looking forward to your reply.
Have a wonderful day!
- You must be logged in to reply to this topic.