set custom discount to quote in magento2

by Manjunath   Last Updated July 09, 2019 12:09 PM

I am creating order pro-grammatically.

I have referred below code

https://www.rakeshjesadiya.com/how-to-create-order-programmatically-in-magento-2/

My requirement is to set discount amount for each cart item.

The discount amount is 5.

I tried below code for that.

 $quote->setDiscountAmount(5);

after the line

$quote->addProduct($product,$buyRequest);

It is not working. Can anyone help me to achieve this functionality.

Thanks



Related Questions


Updated March 06, 2017 08:09 AM

Updated May 21, 2015 22:04 PM

Updated December 30, 2017 17:09 PM

Updated June 23, 2019 17:09 PM

Updated July 23, 2015 14:04 PM