1

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();

Rafael Fagundes
  • 435
  • 3
  • 14

1 Answers1

1

I solved this following this tutorial Magento 2 : How to load quote by quote id

looks like the load function is depreciated and doesn't works anymore.

Rafael Fagundes
  • 435
  • 3
  • 14