33 votes

Magento 2 - Why do SKU not change dynamically in configurable product view page

I wrote the module based on Fabian Schmengler's solution. This works for me on Magento 2.1.3. /app/code/YourVendor/YourModule/view/frontend/requirejs-config.js var config = { config: { ...
nbjohan's user avatar
  • 521
16 votes
Accepted

Magento 2 - Why do SKU not change dynamically in configurable product view page

I did that once for Magento 2.0, don't have the code available but can show you where you need to make changes: Write a Plugin for Magento\ConfigurableProduct\Block\Product\View\Type\Configurable::...
Fabian Schmengler's user avatar
9 votes

Magento 2 - get special price of product by product id or sku

Use \Magento\Catalog\Model\ProductRepository class to get the special price of the product protected $_productRepository; public function __construct( ... \Magento\Catalog\Model\...
Prince Patel's user avatar
  • 22.7k
8 votes
Accepted

What is the difference between Product ID and SKU?

Product ID 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 ...
Lez's user avatar
  • 2,907
7 votes
Accepted

update Sku in using catalog_product_save_after in magento 2

It's because you are using catalog_product_save_after. so on product save you are again saving and again this event called so bottleneck happen. I would suggest to use different event. or Use ...
Keyur Shah's user avatar
6 votes
Accepted

Magento 2.1 Update Product Stock in Cron Job

I'm not sure about your data array which contains the SKU product and Stock value. So, I will use simple data. We can update product stock via API: vendor/magento/module-catalog-inventory/Model/...
Khoa TruongDinh's user avatar
6 votes
Accepted

How to get Magento2 product with REST if sku has slash?

I was hoping there where a well known workaround for this, but for now I solved it by writing plugins. To get and put product, I plugged in before the get and save function in \Magento\Catalog\Api\...
TNordkvist's user avatar
6 votes
Accepted

How can I Get Sku In Products Ordered Reports

open app\code\core\Mage\Adminhtml\Block\Report\Product\Sold\Grid.php and put the below code in _prepareColumns() function You can move Grid.php in your local folder as well or can override it in ...
Gopal Patel's user avatar
  • 3,139
6 votes

How can I Get Sku In Products Ordered Reports

You should rewrite magento core block Mage_Adminhtml_Block_Report_Product_Sold_Grid, here is the solution: <blocks> <adminhtml> <rewrite> <...
Arshad Muhammad's user avatar
6 votes
Accepted

Magento 2 REST - SKU to items on cart totals API response is not available, How to get SKU in response API

Extension attribute is the simplest way to achieve this. extension_attributes.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Ramkishan Suthar's user avatar
5 votes

How to create coupon for specific SKU

Set Attribute property: Store->Attribute(Product)->SKU->storefront properties : This will allow your attribute to be in list of Cart Rule -> condition.(above answer i mentioned.)
Ronak Chauhan's user avatar
5 votes

Change SKU to be non-unique

Technically it's possible with an upgrade script that changes the properties of the "sku" attribute. But don't do that, Magento relies on distinctly referencing a product by its SKU. I worked on a ...
Fabian Schmengler's user avatar
5 votes

SQL Query to fetch all child SKUs by using the configurable SKU

$parentSku = 'testSku'; SELECT t2.sku FROM (SELECT b.child_id FROM `catalog_product_entity` a LEFT JOIN `catalog_product_relation` b ON b.`parent_id` = a.`entity_id` WHERE a.sku = '{$parentSku}') ...
jericrealubit's user avatar
5 votes
Accepted

Magento 2.2 How to add product sku to order confirmation email?

Override vendor/magento/module-sales/view/frontend/templates/email/items/order/default.phtml to your theme app/design/frontend/vendor/theme/Magento_Sales/templates/email/items/order/default.phtml ...
Prince Patel's user avatar
  • 22.7k
5 votes
Accepted

Magento 2 this is possible to set different SKU store wise on a same product

This is not possible and it should not be possible. Why is not possible: The sku is kept in the catalog_product_entity table. This is the main table for products. This means it's not an EAV ...
Marius's user avatar
  • 198k
5 votes
Accepted

How to add SKU in the attribute list in the More Information tab of the product view page?

You don't need to do anything like that You just follow below step to display sku in More Information tab on product view page Go to Stores -> Attributes -> Product Search SKU attribute and edit it ...
Naresh Rupareliya's user avatar
4 votes

How to get Magento2 product with REST if sku has slash?

Here is better workaround, no need to rewrite anything. Just create module containing only this webapi.xml file. Or just simply add to any existing module you have in project (even faster but not ...
A.Maksymiuk's user avatar
4 votes

Magento - Display SKU on Category Page

Try this,hope it's work. <?php $current_product = Mage::registry('current_product'); if($current_product) { $sku = $current_product->getSku(); // ...
J.wiston's user avatar
4 votes

What is the difference between Product ID and SKU?

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 ...
Nidheesh's user avatar
  • 1,048
4 votes

What is the difference between Product ID and SKU?

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 ...
Stepan Furman's user avatar
4 votes
Accepted

Load Product Qty by sku in Magento 2 Controller

First load product by sku: $product = $this->_productRepository->get($sku); To get stock qty use this: $StockState->getStockQty($product->getId(), $product->getStore()->...
Shoaib Munir's user avatar
  • 9,414
4 votes

Following products with requested skus were not found:

Keeping this here in case someone else experiences the same problem from a Magento 1 migration. I've had a look at the file where the exception is triggered from (\vendor\magento\module-inventory-...
Chris's user avatar
  • 634
3 votes

How to display the sku of product in javascript?

You need to overwrite Mage_Catalog_Block_Product_View_Type_Configurable class #app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php public function getJsonConfig() { $config = ...
Sohel Rana's user avatar
  • 35.8k
3 votes
Accepted

Magento 2 - get special price of product by product id or sku

use Magento/Catalog/Model/ProductFactory to load product, and get price information from the model Code is like: $specialPrice = $this->productFactory()->create()->load($id)->...
Tomi's user avatar
  • 305
3 votes

Magento2 Auto Increment SKU

Till now Magento does not have such functionality. Though Magento provides the feature to set the mask for autogenerating SKU field. To do so, go to Stores > Configuration > Catalog > Product ...
Mohit Kumar Arora's user avatar
3 votes
Accepted

How does Magento 2 sku generated automatically?

For sku generation has settings: Stores -> Configuration -> Catalog Change Mask for SKU to somedigits_{{name}} [Update] SKU js component: Magento_Catalog/js/components/import-handler Location: ...
Sohel Rana's user avatar
  • 35.8k
3 votes
Accepted

How to remove SKU column from order details in My account page

For that you need to override two phtml files, module-sales/view/frontend/templates/order/items.phtml module-sales/view/frontend/templates/order/items/renderer/default.phtml Overide Into following ...
aravind's user avatar
  • 1,844
3 votes

Load Product Qty by sku in Magento 2 Controller

Get the quantity by using the following code protected $_stockRepository; protected $_product; public function __construct( Magento\CatalogInventory\Model\Stock\StockItemRepository $...
Mitali's user avatar
  • 451
3 votes

Search by SKU in Magento not working properly

Add Below code in below file. /vendor/magento/module-elasticsearch/SearchAdapter/Query/Builder/Match.php Add below line Number 86 replace condition if ($matchKey != 'match_phrase_prefix') { $...
Mohit Patel's user avatar
  • 3,813
2 votes

Magento Order Grid filters

You firstly should change errors/local.xml.sample to errors/local.xml. It will help you show the error. After that update us what you see.
phanvugiap's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible