1

I have set custom product price using a controller and it works fine but when I go to cart page I see grand total not set to the zero.Because the summary section loads using the ajax after some time automatically.

I used this link in my controller :- I want to set custom price programmatically to the product Magento 2
Please see the screenshot I have attached below. first the order total and subtotal set to zero but after some time it loads automatically and set the price as default price.

foreach ($products_array as $value) 
{
    $params['qty'] = 1;//product quantity
    $_product = $this->productRepository->getById($value);
    $_product->setPrice(0);
    $_product->setBasePrice(0);
    $quote->addProduct($_product,$params); 
} 

enter image description here

enter image description here

enter image description here

Kushal Dani
  • 2,114
  • 2
  • 17
  • 49

0 Answers0