Magento 2 – Import Products with Custom Options

custom-optionsimportmagento-2.1.3magento2

I'm trying to add custom options for my products, using import product tools.

This is how my csv file looks like:

sku,custom_options
1001BG,"name=Line 1,type=field,required=0,price=0.0000,price_type=fixed,sku=,max_characters=5"

This is the error I get:

"General system exception happened"

Any hint is appreciated.

P.S.: I tried to Convert to UTF-8-BOM, still not working.

I use Magento CE 2.1.3.

Best Answer

Custom options are processed in

\Magento\CatalogImportExport\Model\Import\Product\Option::_parseCustomOptions()

There is line

1859 $options[$name][$k]['_custom_option_store'] = $rowData[Product::COL_STORE_VIEW_CODE];

Expectations here are that your CSV file contains column store_view_code. In case the column is absent, E_NOTICE is triggered.

For every error Magento generates an exception. So here low level exception with next text is throwed:

Notice: Undefined index: store_view_code in /var/www/html/magetwo.vg/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php on line 1859

To solve this just add empty column store_view_code to CSV file

sku,store_view_code,custom_options
1001BG,,"name=Line 1,type=field,required=0,price=0.0000,price_type=fixed,sku=,max_characters=5"