Make frontend scripts safe to run on non WC pages (check for objects)

For a more detailed explaination of why this is helpful, see
Issue #4202. In short, from a dev ops perspective, if we want to build /
concatonate our front end scripts into a single application.js file, we
need to ensure scripts first check for dependent global object helpers
before trying to use them. For example, there are several objects
(created via PHP using `wp_localize_script`) which generate objects such
as `wc_single_product_params`. These objects will not exist on most
other pages, however these scripts attempt to execute code that
references these objects.