I’ve discount product in my system, instead of adding discount product from system i need to add product from json response. I’m running in loop that adding product and price update. It’s working with 2 set of data but not working single data. this is my code.
foreach ($key['container] as $sku) {
$loadProduct = $this->getModel('catalog/product')
->loadByAttribute('sku', $sku);
$addedItem = $cart->addProduct($loadProduct->getId());
if (!is_string($addedItem)) {
$addedItem->getProduct()->setIsSuperMode(true);
$addedItem->setCustomPrice($price);
$addedItem->setOriginalCustomPrice($price);
$addedItem->save();
}
}
}
$cart->save();
The issue I’ve defined a product ABC has -10 price in my system but i need to change this as -15 for ABC. If the price is 0.00 in system it’s updating but if i override > 0 price it’s not updating.