How to Get shipping rates from the quote and a change Price | change product prices per quote

How to Get shipping rates from the quote and a change Price | change product prices per quote

SHIPPING

   $rates = $quote->getShippingAddress()->getShippingRatesCollection();
   foreach ($rates as $rate)
     {
       $rate->setPrice(0.00)->save();
     }

For Returning the values you should recalculate the Rules

  $quote->getShippingAddress()->setCollectShippingRates(true)->collectShippingRates();

QUOTE ITEM

 foreach ($quote->getAllVisibleItems() as $item) {
   $item->setCustomPrice( $item->getProduct()
       ->getPrice())->setOriginalCustomPrice($item->getProduct()->getPrice())
       ->getProduct()->setIsSuperMode(false);
   $item ->getProduct()->setTaxClassId(0);
   $item->calcRowTotal();
}


If this solution isn't working for you, seek answers from ChatGPT


Please note that to ensure accurate and relevant responses, your questions should be related to Magento 2.

Ready to elevate your e-commerce business?

Let's talk about your business goals. Contact us now to see how we can help achieve them.

 
Copyright © 2021-present ArmMage Inc. All rights reserved.