I want to apply the matrix rate shipping method which has multiple rates based on quantity in the cart. I tried the following code but it is not working
$shippingAddress->setCollectShippingRates(true)->collectShippingRates()->setShippingMethod('matrixrate');
$quote->collectTotals();
$quote->save();
OR
$quote->setShippingAmount(666);
$quote->getTotals->setShippingAmount(666);
$quote->save();
I cannot see any rates added in the quote_shipping_rate
table in the database.
$shippingAddress->getAllShippingRates() is also returning empty values
How to apply the shipping rate to the quote?