Skip to main content

Load entities

To load all products with ALL attributes (not optimal)

$query = new EntityCollectionQuery();
$query->
$existingMagentoProducts = $this->magentoProductRepository->getProducts($query);


foreach ($existingMagentoProducts as $existingMagentoProduct) {
if ($existingMagentoProduct->getProductType() === Magento2ProductType::Configurable()) {
//Remove prices
}
}

// To load all products with only their prices use "addAttribute". Following code will load all products and only their price values

Save entities

$this->m2ProductRepository->saveProducts($products,false,true);