scoo-b wrote:
To view order status for guest customers I used Order GUID. Please see instructions below:

NopCommerce V3.7
Source Code required

1: Nop.Web\Models\OrderDetailsModel.cs
Create new property in class OrderDetailsModel
public Guid OrderGuid { get; set; }


2: Nop.Web\Models\CustomerOrderListModel.cs
Create new property in class OrderDetailsModel
public Guid OrderGuid { get; set; }


3: Nop.Web\Controllers\OrderController.cs

3A: Insert this at line 143
OrderGuid = order.OrderGuid


3B: Modify ActionResult Details, around line 612

public ActionResult Details(int orderId, Guid? orderGuid)
{
  var order = _orderService.GetOrderById(orderId);
  if (order == null || order.Deleted || orderGuid != order.OrderGuid )
    return new HttpUnauthorizedResult();
  var model = PrepareOrderDetailsModel(order);
  return View(model);
}


4: Nop.Web\Views\Order\CustomerOrders.cshtml
Modify the button to include OrderGuid
onclick="window.open('@Url.RouteUrl("OrderDetails", new { orderId = order.Id, orderGuid = order.OrderGuid })')"


Finally, you will have to edit order confirmation email template so that when guest customers receive their email it will have the link with the OrderGuid. I have not done this yet but you will have to create OrderGuid token in Nop.Services\Messages and go from there.


Another idea might be something similar the following, although you'd need to create a different view to post zip, or if you accept international orders you'd need to use some other property than zip - cleansed phone number perhaps?


public ActionResult Details(int orderId, string zipCode)
{
  var order = _orderService.GetOrderById(orderId);
        if(order == null || order.Deleted){
             return new HttpNotFoundResult();
        }

  if(_workContext.CurrentCustomer.Id != order.CustomerId &&  ((zipCode ?? "").Length < 5 || order.BillingAddress.ZipPostalCode.Substring(0, 5) != zip.Substring(0, 5))){
             return new HttpUnauthorizedResult();
        }
    
  var model = PrepareOrderDetailsModel(order);
  return View(model);
}