Can a rule be applied based on what other items are in the cart in magento?

Yes, with Auto Add Promo Items (Free Gift) extension you can create a rule which adds a free product if the specified conditions are met, like 'give a free pair of socks if a pair of shoes is in the cart':

Y is socks SKU and X is shoes SKU

Auto Add promo Items - Amasty

 

 

See more details on Auto Add Promo Items page

User Guide

How can we help you?

Didn’t you find the answer to your question? We are always happy to help you out.