How to fix «Please specify a shipping method» for a PayPal Payflow backend order?

Step 1

Locate the line:

Add the folllowing code above:

$quote->setTotalsCollectedFlag(true);
$quote['dfSkipTotalsCollection'] = true;

Step 2

Replace the line:

with the following one:

if (!$quote->isVirtual() && $quote->getShippingAddress() && !$quote['dfSkipTotalsCollection']) {

Step 3

Replace the line:

with the following code block:

if (!$quote['dfSkipTotalsCollection']) {
	$quote->setTotalsCollectedFlag(false)->collectTotals();
}
$quote->unsetData('dfSkipTotalsCollection');
$quote->save();

A similar issue: The payment block shows «Please specify shipping method» while a third-part checkout extension is used