Allow link_to_cart to be used outside of Spree context

Fixes #2441