What is the difference between Product ID and SKU in Magento 2?
is an internal unique identifier of a product in Magento which corresponds to the product increment in Magento's database.
You can't set it manually because it is auto-incremented in catalog_product_entity table.
is also a unique product identifier, but it can be set manually by the administrator while creating a product and it shows on the frontend for customers to see, so they can reference the product by SKU.
SKU is also a product attribute, while Product ID isn't.
And it is often used for connecting products between ERP or commercial software and Magento web shops.
Product ID is the primary key of the the product base table. But SKU (Stock Keeping Unit) is a unique value which can also be used to identify a product.
Magento won't allow the store admin to decide the Product ID as it is an auto increment value. But store admin can decide the SKU of his product.
Example data: Product ID will be: 1, 2, 3, .... 100025 etc SKU will be: MY-PRODUCT-001, SOMETHING9089, 100222052 etc..
Hope that make sense.
they are almost the same for user, but different for developer and for it's purpose. Here is why:
- Product id is used as primary key for DB store.(it's faster for searching and so on)
- SKU used for unique identifier of product
Imagine that you transfer products from one db to another, or you have inventory service that communicate with magento through the web api, primary key is auto-incremented so you would have different product id in different databases for one product, but sku will be the same.