diff --git a/Model/Carrier.php b/Model/Carrier.php index b823ddd..abf08e3 100644 --- a/Model/Carrier.php +++ b/Model/Carrier.php @@ -317,7 +317,9 @@ protected function getMethodTitle(\Magento\Quote\Model\Quote\Address\RateRequest } // Select default servicePoint if none is selected - if (!$servicePointId) { + $selectFirstByDefault = $this->getConfigData('shipping_methods/servicepoint/default_select_first'); + + if (!$servicePointId && $selectFirstByDefault) { $toCountry = $request->getDestCountryId(); $toPostalCode = $request->getDestPostcode(); $servicePoint = $this->servicePointService->getClosest($toPostalCode, $toCountry); diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index c86bbed..d47bd6a 100755 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -738,6 +738,15 @@ Leave empty to use default title + + + Magento\Config\Model\Config\Source\Yesno + By enabling this option, if the customer is not selecting a service point, the most closeby service point will be selected. + + 1 + +