inventory icon indicating copy to clipboard operation
inventory copied to clipboard

Refactor InventoryDistanceBasedSourceSelection plugin to handle exceptions instead of silent fail

Open sidolov opened this issue 6 years ago • 0 comments

\Magento\InventoryDistanceBasedSourceSelection\Plugin\FillSourceLatitudeAndLongitude

 public function beforeSave(
        SourceRepositoryInterface $subject,
        SourceInterface $source
    )array {
        if (!$source->getLatitude() && !$source->getLongitude()) {
            try {
                $latLng = $this->getLatLngFromSource->execute($source);
                $source->setLatitude($latLng->getLat());
                $source->setLongitude($latLng->getLng());
            } catch (\Exception $e) {
                unset($e); // Silently fail geo coding
            }
        }

sidolov avatar Apr 04 '20 16:04 sidolov