$ecomConfig

$ecomConfig

Source:
General config values for E-Com Plus apps. It tries to get values from metatags or `window` on browser, or `proccess.env` on Node.js environments, when undefineds it uses predefined constants.

Check all common config properties on `src/lib/config.js` file.

Examples

// Preset config on browser with HTML meta tags
<meta name="ecom-store-id" content="1011">
<meta name="ecom-store-object-id" content="5b1abe30a4d4531b8fe40725">
<meta name="ecom-lang" content="pt_br">
// Preset config on browser with JS window
window.ECOM_STORE_ID = 1011
window.ECOM_STORE_OBJECT_ID = '5b1abe30a4d4531b8fe40725'
window.ECOM_LANG = 'pt_br'
// Preset config on Node.js env
process.env.ECOM_STORE_ID = 1011
process.env.ECOM_STORE_OBJECT_ID = '5b1abe30a4d4531b8fe40725'
process.env.ECOM_LANG = 'pt_br'

Methods

(static) get(prop)

Source:
Get the stored value for specified config property.
Example
$ecomConfig.get('store_id')
// => 1011
$ecomConfig.get('currency')
// => 'USD'
$ecomConfig.get('currency_symbol')
// => '$'
Parameters:
Name Type Description
prop string Configuration property

(static) set(prop, value)

Source:
Save the value for specified config property.
Example
$ecomConfig.set('store_id', 1012)
Parameters:
Name Type Description
prop string Configuration property
value string New prop value