Ever needed to dynamically add/remove products to a visitor’s cart based on their cart contents?
The below functions will help you do just that. Place them in the functions.php of your theme or (better) in a separate plugin and you are all set. Just make sure to modify the qualifies_for_incentive function to work based on your rules.