Magento 2 - The shipping method is missing. Select the shipping method and try againconfigure Magento 2.3 with Will-Call only shipping methodMissing file from static Magento 2Magento2 : Error The “Is New” attribute value is empty. Set the attribute and try againmagento 2 - display shipping method logoHow to Unset the shipping method from quote in magento 2?Magento 2 how to show shipping method between shipping address and payment?Magento 2 : Product options date saved less then select date while add to cartDHL Shipping Method not show on checkout pagemagento 2.3.0 shipping method based coupon code not working in cart pageSet Shipping Method Programatically
Does the sensor of a dslr count the number of photons that hits it?
How to factor a fourth degree polynomial
As a supervisor, what feedback would you expect from a PhD who quits?
Why do airports remove/realign runways?
What is the maximum amount of diamond in one Minecraft game?
Howto display unicode character u2026 in terminal mode in emacs
Passwordless authentication - how invalidate login code
Why does this function pointer assignment work when assigned directly but not with the conditional operator?
Groups where no elements commute except for the trivial cases
Tiny URL creator
How do I check that users don't write down their passwords?
Does the Milky Way orbit around anything?
How did the IEC decide to create kibibytes?
Taking advantage when HR forgets to communicate the rules
Attach a visible light telescope to the outside of the ISS
Is reasonable to assume that the 食 in 月食/日食 can be interpreted as the sun/moon being "eaten" during an eclipse?
Wouldn't putting an electronic key inside a small Faraday cage render it completely useless?
Is there a minimum amount of electricity that can be fed back into the grid?
Bringing coumarin-containing liquor into the USA
Wearing special clothes in public while in niddah- isn't this a lack of tznius?
Why do people prefer metropolitan areas, considering monsters and villains?
Alternative to Willpower in Fighting Cravings
Any way to meet code with 40.7% or 40.44% conduit fill?
Initializing variables in an "if" statement
Magento 2 - The shipping method is missing. Select the shipping method and try again
configure Magento 2.3 with Will-Call only shipping methodMissing file from static Magento 2Magento2 : Error The “Is New” attribute value is empty. Set the attribute and try againmagento 2 - display shipping method logoHow to Unset the shipping method from quote in magento 2?Magento 2 how to show shipping method between shipping address and payment?Magento 2 : Product options date saved less then select date while add to cartDHL Shipping Method not show on checkout pagemagento 2.3.0 shipping method based coupon code not working in cart pageSet Shipping Method Programatically
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to set the Shipping Method Programatically on place Order using Below code . But I am Getting Error
For your Reference I am Using https://github.com/magestat/magento2-split-order/
Code
message: "The shipping method is missing. Select the shipping method and try again."
/**
* Places an order for a specified cart.
*
* @param QuoteManagement $subject
* @param callable $proceed
* @param int $cartId
* @param string $payment
* @return mixed
* @throws LocalizedException
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @see MagentoQuoteApiCartManagementInterface
*/
public function aroundPlaceOrder(QuoteManagement $subject, callable $proceed, $cartId, $payment = null)
$currentQuote = $this->quoteRepository->getActive($cartId);
// Separate all items in quote into new quotes.
$quotes = $this->quoteHandler->normalizeQuotes($currentQuote);
if (empty($quotes))
return $result = array_values([($proceed($cartId, $payment))]);
// Collect list of data addresses.
$addresses = $this->quoteHandler->collectAddressesData($currentQuote);
/** @var MagentoSalesApiDataOrderInterface[] $orders */
$orders = [];
$orderIds = [];
$orderSrNo = 1;
$this->checkoutSession->setOrderSrNO($orderSrNo);
foreach ($quotes as $items)
/** @var MagentoQuoteModelQuote $split */
$split = $this->quoteFactory->create();
// Set all customer definition data.
$this->quoteHandler->setCustomerData($currentQuote, $split);
$this->toSaveQuote($split);
// Map quote items.
foreach ($items as $item)
// Add item by item.
$item->setId(null);
$split->addItem($item);
$this->quoteHandler->populateQuote($quotes, $split, $items, $addresses, $payment);
// Dispatch event as Magento standard once per each quote split.
$this->eventManager->dispatch(
'checkout_submit_before',
['quote' => $split]
);
$this->helperData->writeLogger('$split->getShippingAddress()->getShippingMethod()');
$this->helperData->writeLogger(json_encode($split->getShippingAddress()->getShippingMethod()));
$split->getShippingAddress()->setShippingMethod('freeshipping_freeshipping');
$split->getShippingAddress()->setCollectShippingRates(true);
$this->toSaveQuote($split);
$order = $subject->submit($split);
$orders[] = $order;
$orderIds[$order->getId()] = $order->getIncrementId();
$orderSrNo++;
$this->checkoutSession->unsOrderSrNO();
$this->checkoutSession->setOrderSrNO($orderSrNo);
if (null == $order)
throw new LocalizedException(__('Please try to place the order again.'));
$currentQuote->setIsActive(false);
$this->toSaveQuote($currentQuote);
$this->quoteHandler->defineSessions($split, $order, $orderIds);
$this->eventManager->dispatch(
'checkout_submit_all_after',
['orders' => $orders, 'quote' => $currentQuote]
);
return $this->getOrderKeys($orderIds);
/**
* Save quote
*
* @param MagentoQuoteApiDataCartInterface $quote
* @return MyModuleSplitOrderPluginSplitQuote
*/
private function toSaveQuote($quote)
$this->quoteRepository->save($quote);
return $this;
/**
* @param array $orderIds
* @return array
*/
private function getOrderKeys($orderIds)
$orderValues = [];
foreach (array_keys($orderIds) as $orderKey)
$orderValues[] = (string) $orderKey;
return array_values($orderValues);
magento2.3
add a comment |
I am trying to set the Shipping Method Programatically on place Order using Below code . But I am Getting Error
For your Reference I am Using https://github.com/magestat/magento2-split-order/
Code
message: "The shipping method is missing. Select the shipping method and try again."
/**
* Places an order for a specified cart.
*
* @param QuoteManagement $subject
* @param callable $proceed
* @param int $cartId
* @param string $payment
* @return mixed
* @throws LocalizedException
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @see MagentoQuoteApiCartManagementInterface
*/
public function aroundPlaceOrder(QuoteManagement $subject, callable $proceed, $cartId, $payment = null)
$currentQuote = $this->quoteRepository->getActive($cartId);
// Separate all items in quote into new quotes.
$quotes = $this->quoteHandler->normalizeQuotes($currentQuote);
if (empty($quotes))
return $result = array_values([($proceed($cartId, $payment))]);
// Collect list of data addresses.
$addresses = $this->quoteHandler->collectAddressesData($currentQuote);
/** @var MagentoSalesApiDataOrderInterface[] $orders */
$orders = [];
$orderIds = [];
$orderSrNo = 1;
$this->checkoutSession->setOrderSrNO($orderSrNo);
foreach ($quotes as $items)
/** @var MagentoQuoteModelQuote $split */
$split = $this->quoteFactory->create();
// Set all customer definition data.
$this->quoteHandler->setCustomerData($currentQuote, $split);
$this->toSaveQuote($split);
// Map quote items.
foreach ($items as $item)
// Add item by item.
$item->setId(null);
$split->addItem($item);
$this->quoteHandler->populateQuote($quotes, $split, $items, $addresses, $payment);
// Dispatch event as Magento standard once per each quote split.
$this->eventManager->dispatch(
'checkout_submit_before',
['quote' => $split]
);
$this->helperData->writeLogger('$split->getShippingAddress()->getShippingMethod()');
$this->helperData->writeLogger(json_encode($split->getShippingAddress()->getShippingMethod()));
$split->getShippingAddress()->setShippingMethod('freeshipping_freeshipping');
$split->getShippingAddress()->setCollectShippingRates(true);
$this->toSaveQuote($split);
$order = $subject->submit($split);
$orders[] = $order;
$orderIds[$order->getId()] = $order->getIncrementId();
$orderSrNo++;
$this->checkoutSession->unsOrderSrNO();
$this->checkoutSession->setOrderSrNO($orderSrNo);
if (null == $order)
throw new LocalizedException(__('Please try to place the order again.'));
$currentQuote->setIsActive(false);
$this->toSaveQuote($currentQuote);
$this->quoteHandler->defineSessions($split, $order, $orderIds);
$this->eventManager->dispatch(
'checkout_submit_all_after',
['orders' => $orders, 'quote' => $currentQuote]
);
return $this->getOrderKeys($orderIds);
/**
* Save quote
*
* @param MagentoQuoteApiDataCartInterface $quote
* @return MyModuleSplitOrderPluginSplitQuote
*/
private function toSaveQuote($quote)
$this->quoteRepository->save($quote);
return $this;
/**
* @param array $orderIds
* @return array
*/
private function getOrderKeys($orderIds)
$orderValues = [];
foreach (array_keys($orderIds) as $orderKey)
$orderValues[] = (string) $orderKey;
return array_values($orderValues);
magento2.3
can you post your whole code
– fmsthird
Jun 27 at 11:26
@fmsthird - I have Updated my Question. THanks
– Sairaj Gadekar
Jun 27 at 12:32
add a comment |
I am trying to set the Shipping Method Programatically on place Order using Below code . But I am Getting Error
For your Reference I am Using https://github.com/magestat/magento2-split-order/
Code
message: "The shipping method is missing. Select the shipping method and try again."
/**
* Places an order for a specified cart.
*
* @param QuoteManagement $subject
* @param callable $proceed
* @param int $cartId
* @param string $payment
* @return mixed
* @throws LocalizedException
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @see MagentoQuoteApiCartManagementInterface
*/
public function aroundPlaceOrder(QuoteManagement $subject, callable $proceed, $cartId, $payment = null)
$currentQuote = $this->quoteRepository->getActive($cartId);
// Separate all items in quote into new quotes.
$quotes = $this->quoteHandler->normalizeQuotes($currentQuote);
if (empty($quotes))
return $result = array_values([($proceed($cartId, $payment))]);
// Collect list of data addresses.
$addresses = $this->quoteHandler->collectAddressesData($currentQuote);
/** @var MagentoSalesApiDataOrderInterface[] $orders */
$orders = [];
$orderIds = [];
$orderSrNo = 1;
$this->checkoutSession->setOrderSrNO($orderSrNo);
foreach ($quotes as $items)
/** @var MagentoQuoteModelQuote $split */
$split = $this->quoteFactory->create();
// Set all customer definition data.
$this->quoteHandler->setCustomerData($currentQuote, $split);
$this->toSaveQuote($split);
// Map quote items.
foreach ($items as $item)
// Add item by item.
$item->setId(null);
$split->addItem($item);
$this->quoteHandler->populateQuote($quotes, $split, $items, $addresses, $payment);
// Dispatch event as Magento standard once per each quote split.
$this->eventManager->dispatch(
'checkout_submit_before',
['quote' => $split]
);
$this->helperData->writeLogger('$split->getShippingAddress()->getShippingMethod()');
$this->helperData->writeLogger(json_encode($split->getShippingAddress()->getShippingMethod()));
$split->getShippingAddress()->setShippingMethod('freeshipping_freeshipping');
$split->getShippingAddress()->setCollectShippingRates(true);
$this->toSaveQuote($split);
$order = $subject->submit($split);
$orders[] = $order;
$orderIds[$order->getId()] = $order->getIncrementId();
$orderSrNo++;
$this->checkoutSession->unsOrderSrNO();
$this->checkoutSession->setOrderSrNO($orderSrNo);
if (null == $order)
throw new LocalizedException(__('Please try to place the order again.'));
$currentQuote->setIsActive(false);
$this->toSaveQuote($currentQuote);
$this->quoteHandler->defineSessions($split, $order, $orderIds);
$this->eventManager->dispatch(
'checkout_submit_all_after',
['orders' => $orders, 'quote' => $currentQuote]
);
return $this->getOrderKeys($orderIds);
/**
* Save quote
*
* @param MagentoQuoteApiDataCartInterface $quote
* @return MyModuleSplitOrderPluginSplitQuote
*/
private function toSaveQuote($quote)
$this->quoteRepository->save($quote);
return $this;
/**
* @param array $orderIds
* @return array
*/
private function getOrderKeys($orderIds)
$orderValues = [];
foreach (array_keys($orderIds) as $orderKey)
$orderValues[] = (string) $orderKey;
return array_values($orderValues);
magento2.3
I am trying to set the Shipping Method Programatically on place Order using Below code . But I am Getting Error
For your Reference I am Using https://github.com/magestat/magento2-split-order/
Code
message: "The shipping method is missing. Select the shipping method and try again."
/**
* Places an order for a specified cart.
*
* @param QuoteManagement $subject
* @param callable $proceed
* @param int $cartId
* @param string $payment
* @return mixed
* @throws LocalizedException
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @see MagentoQuoteApiCartManagementInterface
*/
public function aroundPlaceOrder(QuoteManagement $subject, callable $proceed, $cartId, $payment = null)
$currentQuote = $this->quoteRepository->getActive($cartId);
// Separate all items in quote into new quotes.
$quotes = $this->quoteHandler->normalizeQuotes($currentQuote);
if (empty($quotes))
return $result = array_values([($proceed($cartId, $payment))]);
// Collect list of data addresses.
$addresses = $this->quoteHandler->collectAddressesData($currentQuote);
/** @var MagentoSalesApiDataOrderInterface[] $orders */
$orders = [];
$orderIds = [];
$orderSrNo = 1;
$this->checkoutSession->setOrderSrNO($orderSrNo);
foreach ($quotes as $items)
/** @var MagentoQuoteModelQuote $split */
$split = $this->quoteFactory->create();
// Set all customer definition data.
$this->quoteHandler->setCustomerData($currentQuote, $split);
$this->toSaveQuote($split);
// Map quote items.
foreach ($items as $item)
// Add item by item.
$item->setId(null);
$split->addItem($item);
$this->quoteHandler->populateQuote($quotes, $split, $items, $addresses, $payment);
// Dispatch event as Magento standard once per each quote split.
$this->eventManager->dispatch(
'checkout_submit_before',
['quote' => $split]
);
$this->helperData->writeLogger('$split->getShippingAddress()->getShippingMethod()');
$this->helperData->writeLogger(json_encode($split->getShippingAddress()->getShippingMethod()));
$split->getShippingAddress()->setShippingMethod('freeshipping_freeshipping');
$split->getShippingAddress()->setCollectShippingRates(true);
$this->toSaveQuote($split);
$order = $subject->submit($split);
$orders[] = $order;
$orderIds[$order->getId()] = $order->getIncrementId();
$orderSrNo++;
$this->checkoutSession->unsOrderSrNO();
$this->checkoutSession->setOrderSrNO($orderSrNo);
if (null == $order)
throw new LocalizedException(__('Please try to place the order again.'));
$currentQuote->setIsActive(false);
$this->toSaveQuote($currentQuote);
$this->quoteHandler->defineSessions($split, $order, $orderIds);
$this->eventManager->dispatch(
'checkout_submit_all_after',
['orders' => $orders, 'quote' => $currentQuote]
);
return $this->getOrderKeys($orderIds);
/**
* Save quote
*
* @param MagentoQuoteApiDataCartInterface $quote
* @return MyModuleSplitOrderPluginSplitQuote
*/
private function toSaveQuote($quote)
$this->quoteRepository->save($quote);
return $this;
/**
* @param array $orderIds
* @return array
*/
private function getOrderKeys($orderIds)
$orderValues = [];
foreach (array_keys($orderIds) as $orderKey)
$orderValues[] = (string) $orderKey;
return array_values($orderValues);
magento2.3
magento2.3
edited Jun 27 at 12:31
Sairaj Gadekar
asked Jun 27 at 11:20
Sairaj GadekarSairaj Gadekar
3131 silver badge11 bronze badges
3131 silver badge11 bronze badges
can you post your whole code
– fmsthird
Jun 27 at 11:26
@fmsthird - I have Updated my Question. THanks
– Sairaj Gadekar
Jun 27 at 12:32
add a comment |
can you post your whole code
– fmsthird
Jun 27 at 11:26
@fmsthird - I have Updated my Question. THanks
– Sairaj Gadekar
Jun 27 at 12:32
can you post your whole code
– fmsthird
Jun 27 at 11:26
can you post your whole code
– fmsthird
Jun 27 at 11:26
@fmsthird - I have Updated my Question. THanks
– Sairaj Gadekar
Jun 27 at 12:32
@fmsthird - I have Updated my Question. THanks
– Sairaj Gadekar
Jun 27 at 12:32
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f279913%2fmagento-2-the-shipping-method-is-missing-select-the-shipping-method-and-try-a%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f279913%2fmagento-2-the-shipping-method-is-missing-select-the-shipping-method-and-try-a%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
can you post your whole code
– fmsthird
Jun 27 at 11:26
@fmsthird - I have Updated my Question. THanks
– Sairaj Gadekar
Jun 27 at 12:32