AI OnAI Off
I have not tested this but I think you would have to create a new "IpAdress" metafield and expand the PurchaseOrder meta class with the field. Then make sure the field is filled during checkout.
After that you should be able to make a search more or less like this:
OrderSearchParameters parameters = new OrderSearchParameters();
OrderSearchOptions options = new OrderSearchOptions();
options.RecordsToRetrieve = 100;
options.StartingRecord = 0;
options.Classes.Add("MyMetaClassName");
parameters.SqlMetaWhereClause = string.Format("META.{0} = '127.0.0.1'", "IpAdresssMetaField");
int totalRecords;
var orders = OrderContext.Current.FindPurchaseOrders(parameters, options, out totalRecords);
Let's say we want to track from which ip address an order was submitted, and we want to be able to search for other orders from same ip address. How can we accomplish this?