You can send triggers based on the purchase of specific products in order to up-sell or offer a discount on the rest of the range, for example.
Add the code below to the Advanced section of a trigger to achieve this:
var matchingSKUs = ['SKU1','SKU2','SKU3'];
result.proceed = false;
var prods_in_attribute = helpers.productsMatch(helpers.getProducts(), 'sku', matchingSKUs);
if (prods_in_attribute > 0) {
result.proceed = true;
}
You need check what the system is capturing as the SKU and update the matchingSKUs
variable to list the relevant products.
If you want to use the product ID instead of the SKU, use:
var matchingIDs = ['ID1','ID2','ID3'];
result.proceed = false;
var prods_in_attribute = helpers.productsMatch(helpers.getProducts(), 'prid', matchingIDs);
if (prods_in_attribute > 0) {
result.proceed = true;
}