Good morning I am migrating my product portfolio from Magento 1 to Magento 2 and I need to bulk upload new SKU codes and new cost prices from an XL or CSV file how do I do this?

Also on Magento 2 there is no longer a product ID which was a code our clients used to identify products - is this no longer a feature and can we use the SKU code instead? If so how do we show this on the site?

Thanks so much in advance Anthony

  • what are your requirements ? you need extension to bulk upload your products
    – Ashar Riaz
    Sep 6 '17 at 10:51
  • I have 9500 products in Magento 2 but need to change all their SKUs and all their cost prices
    – A Royle
    Sep 6 '17 at 11:03
  • are you developer? read below answer . make a new extension and import products with csv file and implement below code.
    – Ashar Riaz
    Sep 6 '17 at 11:23

you need to do something like this is extension

    $objectManager =\Magento\Framework\App\ObjectManager::getInstance(); // instance of object manager
                    $product = $objectManager->create('\Magento\Catalog\Model\Product');

                    $prod = $product->loadByAttribute('sku', $sku);
        $prod->setSku($newsku); // name of your custom attribute

Personally I found this script to be the most effective way: https://www.hummingbirduk.com/how-to-change-skus-in-bulk-in-magento/

Steps: 1. Upload the php file they provide to an area of the website owned by the web user 2. You create a CSV that has two columns for existing and new SKU 3. Access the file to run it. If you want to run the file using a browser you need to make sure the script and csv is uploaded to a publicly accessible web folder (webroot is ideal) 4. Once this is completed make sure you remove the script or move it outside the web root to avoid anyone/bots finding it and running it many times to cause load on the server

Alternatively you could try Magmi: I've used it on Mage 1 to great effect. It's a very powerful (also dangerous if not secured and can cause database issues if incorrectly used as it uses direct MySQL injection) tool, which allows for mass creation and updating for products as well as categories attributes and more.

The code is on Github here: https://github.com/tagesjump/magmi-m2

According to the repo it has been updated to work with Magento 2, but is still in Beta for Mage2.1.*

Hope that helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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