For any orders with multiple SKUs, where you want to 'include only' a search criteria containing exclusively the SKUs you're searching for, verbatim, and not a list of all orders containing any one of the SKUs mentioned.
For example:
INBK201708CA
WI6PK1
WISB01480CA
WISB01572CA
WISB01743CA
WISB01745CA
WISB01878CA
WISB02540CA
In Infoplus, if you searched on the order table, you would receive a list of all orders containing any one of those SKUs. This script allows you to define a set of SKUs to consider, and it will search for orders that only have that set of SKUs. This script can run against the order table (once you have edited the script to include the SKUs you'd like to consider).
var skuSet = {}; // Here, we define the set of SKUs that you want to consider. Each SKU gets its own line. skuSet["BASIC1"] = 1; skuSet["BASIC2"] = 1; skuSet["BASIC3"] = 1; // Here, we define the tag name that you want applied to the orders var tagName = "all-lines-were-in-set"; // Below here we will look at all of the line items on the order. // If all are in the skuSet, we will then put the tag on the order. utils.log("Looking at line items on order [" + order.orderNo + "]"); for(var i=0; i<order.lineItems.size(); i++) { var sku = order.lineItems.get(i).sku; utils.log("Looking at line [" + i + "] which is sku [" + sku + "]"); if(skuSet[sku]) { utils.log("- This SKU is in the set!"); } else { utils.log("- This SKU is NOT in the set. Exiting."); return; } } utils.log("All lines on the order were in the set."); utils.log("Tag [" + tagName + "] will be added to the order."); infoplusApi.addTag("order", order.orderNo, tagName);