As we can see Magento2 is much more depends on KO(Knockout JS).
Magento 2 don't allow to update price from admin for the configurable product.
Once configurable product is created from admin, price field is disabled.
To enable price field, I have created module and changed small code.
I don't know this is the proper method or not, but that is working for me.
1. Create a PHP file: app/code/Gopal/ConfigurablePrice/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Gopal_ConfigurablePrice',
__DIR__
);
2. Create a XML file: app/code/Gopal/ConfigurablePrice/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Gopal_ConfigurablePrice" setup_version="1.0.0">
<sequence>
<module name="Magento_Catalog" />
<module name="Magento_ConfigurableProduct" />
</sequence>
</module>
</config>
3. Create a XML file: app/code/Gopal/ConfigurablePrice/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier\ConfigurablePrice">
<plugin name="enable_price_configurable_product" type="Gopal\ConfigurablePrice\Plugin\DataProvider\Product\Form\Modifier\ConfigurablePrice" sortOrder="20" disabled="false"/>
</type>
</config>
4. Create a file: app/code/Gopal/ConfigurablePrice/Plugin/DataProvider/Product/Form/Modifier/ConfigurablePrice.php
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Gopal\ConfigurablePrice\Plugin\DataProvider\Product\Form\Modifier;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Catalog\Api\Data\ProductAttributeInterface;
use Magento\Catalog\Model\Locator\LocatorInterface;
use Magento\ConfigurableProduct\Model\Product\Type\Configurable as ConfigurableType;
use Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier\ConfigurablePrice as ConfigurablePriceCore;
/**
* Data provider for price in the Configurable products
*/
class ConfigurablePrice extends ConfigurablePriceCore
{
/**
* {@inheritdoc}
*
* Added after listener for make price field editable in configurable produc edit page.
*/
public function afterModifyMeta($subject, $result)
{
$groupCode = $this->getGroupCodeByField($result, ProductAttributeInterface::CODE_PRICE)
?: $this->getGroupCodeByField($result, ConfigurablePriceCore::CODE_GROUP_PRICE);
if (!empty($result[$groupCode]['children'][ConfigurablePriceCore::CODE_GROUP_PRICE])) {
$result[$groupCode]['children'][ConfigurablePriceCore::CODE_GROUP_PRICE]['children']['price']['arguments']['data']['config']['imports']['disabled'] = 0;
}
return $result;
}
}
Now, please run below commands
php bin/magento module:enable Gopal_ConfigurablePrice
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
Now price field is must be enabled: Check screenshot of the configuable product page in admin.
If above link is useful to you then please accept answer at: https://magento.stackexchange.com/questions/171452/magento-2-edit-price-field-in-configurable-product-in-admin-panel