33c5b41e3f
* align code styles with the same configuration as Woo-Blocks * initial pass of reformat-files * applies manual fixes to various new linting errors surfaced by the configuration change. * Fix state mutation in image-upload * remove unused pre-commit-hook.js * requestAnimationFrame -> window.requestAnimationFrame * wc-api eslint changes * eslint fixes on client/lib and client/settings * client/header eslint changes * fixes for client/dashboard part 1 * fixes client/dashboard part 2 of 2 * client/analytics part 1 * client/analytics continued * client/analytics, last batch * rename __mock__ directory * pass in useEffect, useState from React component or function * remove '+' from sprintf string argument * use ref instead of findDOMNode * reformat and repaply package.json changes * install deps before running linter in Travis * useGetCountryStateAutofill * counryStateAutofill * countryStateAutofill Co-authored-by: Paul Sealock <psealock@gmail.com> |
||
---|---|---|
.. | ||
historical-data | ||
README.md | ||
config.js | ||
default-date.js | ||
index.js | ||
index.scss | ||
setting.js | ||
setting.scss |
README.md
Settings
The settings used to modify the way data is retreived or displayed in WooCommerce reports.
Extending Settings
Settings can be added, removed, or modified outside oc wc-admin
by hooking into woocommerce_admin_analytics_settings
. For example:
addFilter( 'woocommerce_admin_analytics_settings', 'wc-example/my-setting', settings => {
return [
...settings,
{
name: 'custom_setting',
label: __( 'Custom setting:', 'woocommerce-admin' ),
inputType: 'text',
helpText: __( 'Help text to describe what the setting does.' ),
initialValue: 'Initial value used',
defaultValue: 'Default value',
},
];
} );
Each settings has the following properties:
name
(string): The slug of the setting to be updated.label
(string): The label used to describe and displayed next to the setting.inputType
(enum: text|checkbox|checkboxGroup): The type of input to use.helpText
(string): Text displayed beneath the setting.options
(array): Array of options used for inputs with selectable options.initialValue
(string|array): Initial value used when rendering the setting.defaultValue
(string|array): Value used when resetting to default settings.