I created an order using Rest Api and i want to change the Produt Price from a Cart. I tried this:
But didn't work, this line: $quote = $this->quoteFactory->create()->load($resultQuote->quote_id); returns null. What could be? Any help is appreciated.
$quote = $this->quoteFactory->create()->load($resultQuote->quote_id);
$items = $quote->getItemsCollection();
foreach ($items as $item) {
$item->setPrice(999);
$item->setRowTotal(999);
$item->setCustomPrice(999);
$item->setOriginalPrice(999);
$item->setOriginalCustomPrice(999);
$item->getProduct()->setIsSuperMode(true);
$item->save();
$quote->save();
}
$quote->setTotalsCollectedFlag(false)->collectTotals();
$quote->save();