woocommerce/plugins/woocommerce-admin/client/analytics/settings
Joshua T Flowers 4d80cad52e Add rebuild tool to settings page (https://github.com/woocommerce/woocommerce-admin/pull/1737)
* Add button input type to analytics settings

* Add callback prop and disabled state to setting

* Add rebuild tool to settings page

* Re-enable setting if error is caught

* Remove rebuild tool from system tools page

* Move report build success message to API response

* Add back key for settings map

* Fix misspelled option group classname

* Conditionally add rebuild tool to non-wc-status page instead of removal hook
2019-03-06 13:32:05 +08:00
..
README.md Add settings page with excluded order statuses (https://github.com/woocommerce/woocommerce-admin/pull/1364) 2019-01-31 09:04:11 +08:00
config.js Add rebuild tool to settings page (https://github.com/woocommerce/woocommerce-admin/pull/1737) 2019-03-06 13:32:05 +08:00
index.js Add rebuild tool to settings page (https://github.com/woocommerce/woocommerce-admin/pull/1737) 2019-03-06 13:32:05 +08:00
index.scss Add settings page with excluded order statuses (https://github.com/woocommerce/woocommerce-admin/pull/1364) 2019-01-31 09:04:11 +08:00
setting.js Add rebuild tool to settings page (https://github.com/woocommerce/woocommerce-admin/pull/1737) 2019-03-06 13:32:05 +08:00
setting.scss Add rebuild tool to settings page (https://github.com/woocommerce/woocommerce-admin/pull/1737) 2019-03-06 13:32:05 +08: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:', 'wc-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.