From 680a12ef4ac33511a86d488c8ae33d29cdf9d863 Mon Sep 17 00:00:00 2001 From: sampoyigi <6567634+sampoyigi@users.noreply.github.com> Date: Tue, 4 Aug 2026 12:32:46 +0100 Subject: [PATCH 1/5] fix: issue where local search autocomplete address is incorrect after user selects an address --- src/Livewire/Concerns/SearchesNearby.php | 2 +- src/View/Components/AccountDashboard.php | 4 ++-- tests/Livewire/LocalSearchTest.php | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Livewire/Concerns/SearchesNearby.php b/src/Livewire/Concerns/SearchesNearby.php index a458190..b6f9aa9 100644 --- a/src/Livewire/Concerns/SearchesNearby.php +++ b/src/Livewire/Concerns/SearchesNearby.php @@ -285,7 +285,7 @@ protected function geocodeSearchPoint($searchPoint) $userLocation = $this->handleGeocodeResponse($collection); - $this->searchQuery = $userLocation->format(); + $this->searchQuery = $userLocation->getFormattedAddress(); return $userLocation; } diff --git a/src/View/Components/AccountDashboard.php b/src/View/Components/AccountDashboard.php index b475a23..c5c9fc8 100644 --- a/src/View/Components/AccountDashboard.php +++ b/src/View/Components/AccountDashboard.php @@ -19,9 +19,9 @@ final class AccountDashboard extends Component public ?int $defaultAddressId; - public string $formattedAddress = ''; + public string $formattedAddress; - public string $customerName = ''; + public string $customerName; public function __construct() { diff --git a/tests/Livewire/LocalSearchTest.php b/tests/Livewire/LocalSearchTest.php index 1578ffb..466d71a 100644 --- a/tests/Livewire/LocalSearchTest.php +++ b/tests/Livewire/LocalSearchTest.php @@ -192,12 +192,13 @@ 'streetName' => 'Main St', 'latitude' => 51.50987615, 'longitude' => -0.1446716, + 'formattedAddress' => '123 Main St', ]), ])); Livewire::test(LocalSearch::class) ->call('onUserPositionUpdated', [51.50987615, -0.1446716]) - ->assertSet('searchQuery', '123 Main St '); + ->assertSet('searchQuery', '123 Main St'); }); it('onUpdateSearchQuery errors when no search query or point', function(): void { From 149d88ec365f8c50ed55bdb6ec29e72b9706cbaf Mon Sep 17 00:00:00 2001 From: Obinna Elvis Okechukwu Date: Tue, 4 Aug 2026 07:00:32 -0500 Subject: [PATCH 2/5] fix(checkout): persist recomputed order total when payment method changes (#88) * fix(checkout): persist recomputed order total when payment method changes Selecting a new payment method only saved the payment code, so a stale pre-fee order_total (set earlier in the request) could be written to the database alongside it. * refactor(checkout): cache cart total once in onChoosePayment Avoids computing the cart total twice and guarantees the comparison and the persisted value are the same total. --- src/Livewire/Checkout.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Livewire/Checkout.php b/src/Livewire/Checkout.php index 4362457..709da18 100644 --- a/src/Livewire/Checkout.php +++ b/src/Livewire/Checkout.php @@ -299,8 +299,13 @@ public function onChoosePayment($code): void $this->checkoutForm->getField('payment')->value = $code; $this->orderManager->applyCurrentPaymentFee($payment->code); - if ($this->order->payment !== $code) { - $this->order->updateQuietly(['payment' => $code]); + $cartTotal = $this->cartManager->getCart()->total(); + + if ($this->order->payment !== $code || $this->order->order_total !== $cartTotal) { + $this->order->updateQuietly([ + 'payment' => $code, + 'order_total' => $cartTotal, + ]); } $this->order = null; From 9357930604b6bc240b6cbe686af50e2bd24a48cf Mon Sep 17 00:00:00 2001 From: Obinna Elvis Okechukwu Date: Tue, 4 Aug 2026 07:01:15 -0500 Subject: [PATCH 3/5] feat(checkout): support partial-type checkout fields (#86) Adds a generic includes/checkout/field-partial.blade.php so extensions can point a checkout field at an arbitrary blade view via 'type' => 'partial', 'path' => '...', matching the existing FormField $path + 'partial' convention used elsewhere in admin forms. Co-authored-by: Claude Sonnet 5 --- resources/views/includes/checkout/field-partial.blade.php | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 resources/views/includes/checkout/field-partial.blade.php diff --git a/resources/views/includes/checkout/field-partial.blade.php b/resources/views/includes/checkout/field-partial.blade.php new file mode 100644 index 0000000..d2a600f --- /dev/null +++ b/resources/views/includes/checkout/field-partial.blade.php @@ -0,0 +1,4 @@ +@include($field->path, [ + 'field' => $field, + 'orderModel' => $orderModel, +]) From dfd3402b18c80057b9897fac45951980d228935f Mon Sep 17 00:00:00 2001 From: iamnothardcoded Date: Tue, 4 Aug 2026 14:04:11 +0200 Subject: [PATCH 4/5] fix(checkout): still require a delivery address when the area restriction is disabled (#87) Since a252f72d the delivery address check is skipped entirely when the "Reject Orders Outside Delivery Area" setting (location_order) is disabled. That setting ships disabled by default, so out of the box a delivery order can be placed with no address at all: address_id ends up NULL and the order is accepted, leaving the restaurant with an undeliverable order. The address fields are not part of the checkout form config, so nothing else validates them - the skipped after() callback was the only guard. Keep the intent of a252f72d (no geocoding or delivery-area enforcement when the restriction is off, so legitimate customers are not blocked by geocoder failures), but still require the address to be present. --- src/Livewire/Checkout.php | 23 +++++++++++++++-------- tests/Livewire/CheckoutTest.php | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/src/Livewire/Checkout.php b/src/Livewire/Checkout.php index 709da18..2fa5377 100644 --- a/src/Livewire/Checkout.php +++ b/src/Livewire/Checkout.php @@ -381,14 +381,21 @@ protected function validateCheckout(Order $order) $this->withValidator(function($validator) use ($order): void { $validator->after(function($validator) use ($order): void { - if ($order->isDeliveryType() && Location::requiresUserPosition()) { - rescue(function(): void { - $this->orderManager->validateDeliveryAddress(array_only($this->fields, [ - 'address_1', 'city', 'state', 'postcode', 'country', - ])); - }, function(Throwable $ex) use ($validator): void { - $validator->errors()->add('delivery_address', $ex->getMessage()); - }); + if ($order->isDeliveryType()) { + if (Location::requiresUserPosition()) { + rescue(function(): void { + $this->orderManager->validateDeliveryAddress(array_only($this->fields, [ + 'address_1', 'city', 'state', 'postcode', 'country', + ])); + }, function(Throwable $ex) use ($validator): void { + $validator->errors()->add('delivery_address', $ex->getMessage()); + }); + } elseif (blank(array_get($this->fields, 'address_1'))) { + // The delivery area restriction is disabled, so the address is + // deliberately not geocoded or area-checked. It must still exist: + // a delivery order without a street address cannot be delivered. + $validator->errors()->add('delivery_address', lang('igniter.local::default.alert_missing_street_address')); + } } if ($this->fields['payment'] && !$this->orderManager->getPayment($this->fields['payment'])) { diff --git a/tests/Livewire/CheckoutTest.php b/tests/Livewire/CheckoutTest.php index 720aaca..9d0fc79 100644 --- a/tests/Livewire/CheckoutTest.php +++ b/tests/Livewire/CheckoutTest.php @@ -277,6 +277,39 @@ function setupCheckout() ->assertHasErrors(['delivery_address' => [lang('igniter.local::default.alert_missing_street_address')]]); }); +it('onValidate requires a delivery address when the delivery area restriction is disabled', function(): void { + setting()->set(['location_order' => '0']); + setupCheckout(); + + // No usable position, so no address is prepared onto the order + LocationFacade::updateUserPosition(new GeoliteLocation('test')); + + $order = resolve(OrderManager::class)->getOrder(); + $order->order_type = Location::DELIVERY; + $order->save(); + LocationFacade::updateOrderType(Location::DELIVERY); + + Livewire::test(Checkout::class) + ->dispatch('checkout::validate') + ->assertHasErrors(['delivery_address' => [lang('igniter.local::default.alert_missing_street_address')]]); +}); + +it('onValidate does not geocode the delivery address when the delivery area restriction is disabled', function(): void { + setting()->set(['location_order' => '0']); + setupCheckout(); + + $order = resolve(OrderManager::class)->getOrder(); + $order->order_type = Location::DELIVERY; + $order->save(); + LocationFacade::updateOrderType(Location::DELIVERY); + + Geocoder::shouldReceive('geocode')->never(); + + Livewire::test(Checkout::class) + ->dispatch('checkout::validate') + ->assertHasNoErrors('delivery_address'); +}); + it('onValidate dispatches an event on success', function(): void { Event::fake(['igniter.orange.validateCheckout']); setupCheckout(); From 6d50e9398221d50b7c597ebfd703c138d963b156 Mon Sep 17 00:00:00 2001 From: sampoyigi <6567634+sampoyigi@users.noreply.github.com> Date: Sat, 8 Aug 2026 19:25:51 +0100 Subject: [PATCH 5/5] feat(checkout): add select field template for checkout forms - Add `field-select.blade.php` to render a floating-label ` has_form_error($field->getName())]) + aria-describedby="{{ $field->getId() }}-feedback" + {!! $field->getAttributes() !!} + > + + @foreach ($field->options() as $value => $label) + + @endforeach + + + +