diff --git a/lib/screens/cart_view_screen.dart b/lib/screens/cart_view_screen.dart index be6c29a..aced334 100644 --- a/lib/screens/cart_view_screen.dart +++ b/lib/screens/cart_view_screen.dart @@ -326,9 +326,20 @@ class _CartViewScreenState extends State { final appState = context.read(); final cartOrderId = appState.cartOrderId; - final businessId = appState.selectedBusinessId; + // Use cart's businessId if appState doesn't have one (delivery/takeaway without beacon) + final businessId = appState.selectedBusinessId ?? _cart!.businessId; - if (cartOrderId == null || businessId == null) return; + if (cartOrderId == null || businessId <= 0) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: const Text("Error: Missing order or business information", style: TextStyle(color: Colors.black)), + backgroundColor: const Color(0xFF90EE90), + behavior: SnackBarBehavior.floating, + margin: const EdgeInsets.only(bottom: 80, left: 16, right: 16), + ), + ); + return; + } // Ensure order type is selected for delivery/takeaway orders if (_needsOrderTypeSelection && _selectedOrderType == null) {