Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Model/Carrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,15 @@
<label>Title</label>
<comment>Leave empty to use default title</comment>
</field>
<field id="default_select_first" translate="label" type="select" sortOrder="450" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Default select first servicepoint</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>By enabling this option, if the customer is not selecting a service point, the most closeby service point will be selected.</comment>
<depends>
<field id="enabled">1</field>
</depends>
</field>
<field id="rate_method" translate="label" type="select" sortOrder="300" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Pricing method</label>
Expand Down