How can I update Magento 2 product’s price programatically
You need to load the product object first and call “setPrice” method to update the price of Magento 2 product
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product_id = 1; $price = "20.12"; $productFactory = $objectManager->get('\Magento\Catalog\Model\ProductFactory'); $product = $productFactory->create()->load($product_id); $product->setPrice($price); $product->save();