EstimateUpdatePost.php 615 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Checkout\Controller\Cart;
  8. class EstimateUpdatePost extends \Magento\Checkout\Controller\Cart
  9. {
  10. /**
  11. * @return \Magento\Framework\Controller\Result\Redirect
  12. */
  13. public function execute()
  14. {
  15. $code = (string)$this->getRequest()->getParam('estimate_method');
  16. if (!empty($code)) {
  17. $this->cart->getQuote()->getShippingAddress()->setShippingMethod($code)->save();
  18. $this->cart->save();
  19. }
  20. return $this->_goBack();
  21. }
  22. }