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

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.