A script file cannot read a PHP value, and the usual workaround is echoing an inline <script> block in the footer and hoping it lands before the file that needs it. wp_localize_script() attaches the data to a registered handle instead, so WordPress prints it immediately above that script tag, in the right order, every time.
wp_enqueue_script('shop-cart', get_template_directory_uri() . '/js/cart.js', array('jquery'), '1.2', true);
wp_localize_script('shop-cart', 'ShopCart', array(
'ajaxUrl' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('shop_cart'),
'currency' => get_option('shop_currency'),
));
Two details differ from writing the tag yourself. The output is escaped for you, which is the point — an apostrophe in a site option is otherwise a syntax error in someone else’s browser. And every value arrives in JavaScript as a string, including integers and booleans, so a quantity limit has to go through parseInt() on the other side and a flag of "0" is very much true.