Add/remove image programmatically to product Magento2
问题 I am facing problem to add/remove image to product programmatically. 回答1: Use following code to add/remove image from product in Magento2. // Instance of object manager $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); *Remove Images From Product*/ $productId = ; // Id of product $product = $objectManager->create('Magento\Catalog\Model\Product')->load($productId); $productRepository = $objectManager->create('Magento\Catalog\Api\ProductRepositoryInterface');