Skip to content

Commit

Permalink
fix: remove unnecessary user position check in OrderManager and enabl…
Browse files Browse the repository at this point in the history
…e postcode field by default

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>
  • Loading branch information
sampoyigi committed Oct 4, 2024
1 parent 7311ace commit fad3ba9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 0 additions & 3 deletions classes/OrderManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ public function validateDeliveryAddress(array $address)
'address_1', 'address_2', 'city', 'state', 'postcode', 'country',
]));

if (!$this->location->requiresUserPosition())
return;

$collection = app('geocoder')->geocode($addressString);
if (!$collection || $collection->isEmpty())
throw new ApplicationException(lang('igniter.local::default.alert_invalid_search_query'));
Expand Down
8 changes: 4 additions & 4 deletions components/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function defineProperties()
'showPostcodeField' => [
'label' => 'Whether to display the postcode form field',
'type' => 'switch',
'default' => false,
'default' => true,
'validationRule' => 'required|boolean',
],
'showCountryField' => [
Expand Down Expand Up @@ -251,7 +251,7 @@ public function onConfirm()

$this->validateCheckoutSecurity();

return rescue(function () use ($data) {
return rescue(function() use ($data) {
$order = $this->getOrder();

$this->validateCheckout($data, $order);
Expand All @@ -269,7 +269,7 @@ public function onConfirm()

if ($redirect = $this->isOrderMarkedAsProcessed())
return $redirect;
}, function (\Throwable $ex) {
}, function(\Throwable $ex) {
flash()->warning($ex->getMessage())->important();

return Redirect::back()->withInput();
Expand Down Expand Up @@ -349,7 +349,7 @@ protected function validateCheckout($data, $order)
'email.unique' => lang('igniter.cart::default.checkout.error_email_exists'),
]);

if ($this->checkoutStep === 'details' && $order->isDeliveryType()) {
if ($this->checkoutStep === 'details' && $order->isDeliveryType() && Location::requiresUserPosition()) {
$this->orderManager->validateDeliveryAddress(array_get($data, 'address', []));
}

Expand Down

0 comments on commit fad3ba9

Please sign in to comment.