I'm using Magento v 2.3.0.

I am trying to skip Shipping Address section and navigate directly to Payment section if customer has a default address.

I have overridden below class to change the link of checkout url


Function overridden


Now I also use the checkout session in above overridden class to get the quote and set the shipping address in it.

I use tablerate_bestway as shipping method.

How do I set the shipping method and recalculate the shipping rate and save it in the quote?


After set the shipping address in quote use below code to set shipping method programatically

$shippingAddress = $quote->getShippingAddress();
        ->setShippingMethod('shippingMethod') //shipping method
        ->setShippingDescription('shipping method description'); //shipping description
  • The starting 5 lines of code worked for me, since shipping rate is calculated again on payment page, there was no need to recalculate it, just set the shipping address and shipping method. Modified above code accordingly, Thanks!
    – Nausif
    Sep 23 '20 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.