cancel
Showing results for 
Search instead for 
Did you mean: 

Show child SKU on sales order

Show child SKU on sales order

In Magento, by default, the sales order items for configurable products are showing the parent product SKU. How can we show the child product SKU for configurable products? I have tried changing the code in the function at vendor/magento/module-sales/Block/Adminhtml/Items/Column/DefaultColumn.php

 

public function getSku()
    {

        return $this->getItem()->getSku();
    }

to

public function getSku()
    {

        return $this->getItem()->getProduct()->getData('sku');
    }

But it still shows the parent SKU.