2

I have quote id I want to update price , base_row_total & other prices related field in quote should i want to set price only rest field should automatically update is this possible or i am thinking wrong . please help thanks in advance

I am using the below Code but its shores only sku,name,store_id,i checked default magento cart Api its storing all vales in quote Table i want to do the same but its not working for me:

 $product = $this->product->get($this->sku);

        $quoteItem = $this->quoteItemFactory->create();

        $quoteItem->setProduct($product);

2 Answers 2

0

Yes. You can changes price of all items of a quote.

Use

$QuoteObjectitem->setCustomPrice($YourPrice);
$QuoteObjectitem->setOriginalCustomPrice($YourPrice);
1
  • I updated my question Commented Oct 12, 2016 at 8:38
0

Looking at quote_item table, you have the price column in that table. If you have an object of $quoteItem, you could set the price directly:

$quoteItem->setPrice($priceHere)

Also here is another answer from @AmitBera, how to update a quote item:

Magento 2 : Updating quote item

$item = $quote->getItemById($item->getId());
if (!$item) {
  continue;
}
$item->setQty((double) $qty);
$item->setCustomPrice($price);
$item->setOriginalCustomPrice($price);
$item->getProduct()->setIsSuperMode(true);
$item->save(); 

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.