Conditional Link to Shopping Cart on All Product Pages

How can I add a conditional checkout button on all product pages, which only displays if something is in the shopping cart?

I'd like to incorporate this tweak in such a way that a) I don't have to add code to each product page separately and b) it won't be overwritten by each update. Any suggestions?

Thanks