woocommerce/plugins/woocommerce-admin/client/analytics/settings
Fernando 6ae4c5fbfd Home Screen - migrated orders panel (https://github.com/woocommerce/woocommerce-admin/pull/5455)
Fixes woocommerce/woocommerce-admin#5238
2020-11-06 14:21:05 +13:00
..
historical-data Remove wc api 🎉 (https://github.com/woocommerce/woocommerce-admin/pull/5075) 2020-09-04 09:45:40 +12:00
README.md wp.data Settings refactor 2020-03-25 16:20:17 +13:00
config.js Home Screen - migrated orders panel (https://github.com/woocommerce/woocommerce-admin/pull/5455) 2020-11-06 14:21:05 +13:00
default-date.js Remove unused lib/date (https://github.com/woocommerce/woocommerce-admin/pull/4987) 2020-08-18 09:53:13 +12:00
index.js Replace useFilters with wp's withFilters (https://github.com/woocommerce/woocommerce-admin/pull/4962) 2020-08-21 11:14:55 +12:00
index.scss Align WooCommerce javascript code standards/linting/styles with WordPress core. (https://github.com/woocommerce/woocommerce-admin/pull/3674) 2020-02-14 15:23:21 +13:00
setting.js Add overrides for OBW styles (https://github.com/woocommerce/woocommerce-admin/pull/4572) 2020-06-16 10:50:22 +12:00
setting.scss Update @wordpress/base-styles and replace deprecated variables (https://github.com/woocommerce/woocommerce-admin/pull/4759) 2020-07-17 12:11:42 +12:00

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.' ),
            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.
  • defaultValue (string|array): Value used when resetting to default settings.