Cannot place an order without a shipping method.
This happens e.g when only virtual products are purchased (downloads, gift cards, ...)
|
if (strpos($order->getShippingMethod(), '_') !== false) { |
Changing that line to this one would fix it:
if (strpos($order->getShippingMethod() ?? '', '_') !== false) {