Toggle the “Physical products” checkbox on by default (https://github.com/woocommerce/woocommerce-admin/pull/4702)

* Toggle the “Physical products” checkbox on by default

* change 'preselect' to 'default'

Co-authored-by: Rebecca Scott <me@becdetat.com>
This commit is contained in:
Bec Scott 2020-07-08 12:14:57 +10:00 committed by GitHub
parent 739a801c2e
commit 3e79e973ab
2 changed files with 7 additions and 1 deletions

View File

@ -26,9 +26,13 @@ class ProductTypes extends Component {
super();
const profileItems = get( props, 'profileItems', {} );
const { productTypes = {} } = getSetting( 'onboarding', {} );
const defaultProductTypes = Object.keys( productTypes )
.filter( key => !! productTypes[ key ].default );
this.state = {
error: null,
selected: profileItems.product_types || [],
selected: profileItems.product_types || defaultProductTypes,
};
this.onContinue = this.onContinue.bind( this );
@ -106,6 +110,7 @@ class ProductTypes extends Component {
render() {
const { productTypes = {} } = getSetting( 'onboarding', {} );
const { error, selected } = this.state;
return (
<Fragment>
<H className="woocommerce-profile-wizard__header-title">

View File

@ -340,6 +340,7 @@ class Onboarding {
'physical' => array(
'label' => __( 'Physical products', 'woocommerce-admin' ),
'description' => __( 'Products you ship to customers.', 'woocommerce-admin' ),
'default' => true,
),
'downloads' => array(
'label' => __( 'Downloads', 'woocommerce-admin' ),