The easiest way to do this would be to "override" the shopping_cart class; it's one of the auto-loaded classes, so an override is possible.
1) Create the folder /includes/classes/overrides and copy /includes/classes/shopping_cart.php into it.
2) Copy the file /includes/auto_loaders/config.core.php into /includes/auto_loaders/overrides and edit lines 63:64 (both 1.3.9 and 1.5.0):
$autoLoadConfig = array('autoType'=>'class', 'loadFile'=>'overrides/shopping_cart.php');
P.S. If the notifier NOTIFIER_CART_GET_PRODUCTS_START raised by the shopping cart class included the value of $check_for_valid_cart, you could accomplish this using an observer class.