diff --git a/plugins/woocommerce/changelog/update-48533-account-creation-settings b/plugins/woocommerce/changelog/update-48533-account-creation-settings new file mode 100644 index 00000000000..63db9e1ae21 --- /dev/null +++ b/plugins/woocommerce/changelog/update-48533-account-creation-settings @@ -0,0 +1,4 @@ +Significance: patch +Type: update + +Updated account settings descriptions for added clarity diff --git a/plugins/woocommerce/client/legacy/css/admin.scss b/plugins/woocommerce/client/legacy/css/admin.scss index 05e415f90c7..7b63dd7cca8 100644 --- a/plugins/woocommerce/client/legacy/css/admin.scss +++ b/plugins/woocommerce/client/legacy/css/admin.scss @@ -5173,6 +5173,10 @@ img.help_tip { float: none; } + td.disabled { + opacity: 0.5; + } + fieldset { margin-top: 4px; @@ -5255,6 +5259,13 @@ img.help_tip { .wc_emails_wrapper { padding: 0 15px 10px 0; } + + legend { + font-weight: 700; + line-height: 1.4; + padding: 5px 0 0; + margin: 0 0 8px !important; + } } .wc-shipping-zone-settings { diff --git a/plugins/woocommerce/includes/admin/class-wc-admin-settings.php b/plugins/woocommerce/includes/admin/class-wc-admin-settings.php index e635fce0824..a5f0de69566 100644 --- a/plugins/woocommerce/includes/admin/class-wc-admin-settings.php +++ b/plugins/woocommerce/includes/admin/class-wc-admin-settings.php @@ -47,7 +47,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) : if ( empty( self::$settings ) ) { $settings = array(); - include_once dirname( __FILE__ ) . '/settings/class-wc-settings-page.php'; + include_once __DIR__ . '/settings/class-wc-settings-page.php'; $settings[] = include __DIR__ . '/settings/class-wc-settings-general.php'; $settings[] = include __DIR__ . '/settings/class-wc-settings-products.php'; @@ -153,7 +153,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) : // Get tabs for the settings page. $tabs = apply_filters( 'woocommerce_settings_tabs_array', array() ); - include dirname( __FILE__ ) . '/views/html-admin-settings.php'; + include __DIR__ . '/views/html-admin-settings.php'; } /** @@ -514,11 +514,19 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) : $visibility_class[] = $value['row_class']; } + $must_disable = $value['disabled'] ?? false; + + if ( $must_disable ) { + $visibility_class[] = 'disabled'; + } + $container_class = implode( ' ', $visibility_class ); - $must_disable = $value['disabled'] ?? false; + $has_title = isset( $value['title'] ) && '' !== $value['title']; + $has_legend = isset( $value['legend'] ) && '' !== $value['legend']; if ( ! isset( $value['checkboxgroup'] ) || 'start' === $value['checkboxgroup'] ) { - $has_tooltip = isset( $value['tooltip'] ) && '' !== $value['tooltip']; + $has_tooltip = isset( $value['tooltip'] ) && '' !== $value['tooltip']; + $tooltip_container_class = $has_tooltip ? 'with-tooltip' : ''; ?> @@ -535,9 +543,9 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) : - + " value="1" - /> diff --git a/plugins/woocommerce/includes/admin/settings/class-wc-settings-accounts.php b/plugins/woocommerce/includes/admin/settings/class-wc-settings-accounts.php index be1c1dd71f7..b8c18059943 100644 --- a/plugins/woocommerce/includes/admin/settings/class-wc-settings-accounts.php +++ b/plugins/woocommerce/includes/admin/settings/class-wc-settings-accounts.php @@ -50,8 +50,9 @@ class WC_Settings_Accounts extends WC_Settings_Page { 'id' => 'account_registration_options', ), array( - 'title' => __( 'Guest checkout', 'woocommerce' ), - 'desc' => __( 'Allow customers to place orders without an account', 'woocommerce' ), + 'title' => __( 'Checkout', 'woocommerce' ), + 'desc' => __( 'Enable guest checkout (recommended)', 'woocommerce' ), + 'desc_tip' => __( 'Allows customers to checkout without an account.', 'woocommerce' ), 'id' => 'woocommerce_enable_guest_checkout', 'default' => 'yes', 'type' => 'checkbox', @@ -60,7 +61,7 @@ class WC_Settings_Accounts extends WC_Settings_Page { ), array( 'title' => __( 'Login', 'woocommerce' ), - 'desc' => __( 'Allow customers to log into an existing account during checkout', 'woocommerce' ), + 'desc' => __( 'Enable log-in during checkout', 'woocommerce' ), 'id' => 'woocommerce_enable_checkout_login_reminder', 'default' => 'no', 'type' => 'checkbox', @@ -69,31 +70,38 @@ class WC_Settings_Accounts extends WC_Settings_Page { ), array( 'title' => __( 'Account creation', 'woocommerce' ), - 'desc' => __( 'Allow customers to create an account during checkout', 'woocommerce' ), + 'desc' => __( 'During checkout', 'woocommerce' ), + 'desc_tip' => __( 'Customers can create an account before placing their order.', 'woocommerce' ), 'id' => 'woocommerce_enable_signup_and_login_from_checkout', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'start', + 'legend' => __( 'Allow customers to create an account:', 'woocommerce' ), + 'autoload' => false, + ), + array( + 'title' => __( 'Account creation', 'woocommerce' ), + 'desc' => __( 'On "My account" page', 'woocommerce' ), + 'id' => 'woocommerce_enable_myaccount_registration', + 'default' => 'no', + 'type' => 'checkbox', + 'checkboxgroup' => 'end', + 'autoload' => false, + ), + array( + 'title' => __( 'Account creation options', 'woocommerce' ), + 'desc' => __( 'Use email address as account login (recommended)', 'woocommerce' ), + 'desc_tip' => __( 'If unchecked, customers will need to set a username during account creation.', 'woocommerce' ), + 'id' => 'woocommerce_registration_generate_username', + 'default' => 'yes', + 'type' => 'checkbox', + 'checkboxgroup' => 'start', 'autoload' => false, ), array( - 'desc' => __( 'Allow customers to create an account on the "My account" page', 'woocommerce' ), - 'id' => 'woocommerce_enable_myaccount_registration', - 'default' => 'no', - 'type' => 'checkbox', - 'checkboxgroup' => '', - 'autoload' => false, - ), - array( - 'desc' => __( 'When creating an account, automatically generate an account username for the customer based on their name, surname or email', 'woocommerce' ), - 'id' => 'woocommerce_registration_generate_username', - 'default' => 'yes', - 'type' => 'checkbox', - 'checkboxgroup' => '', - 'autoload' => false, - ), - array( - 'desc' => __( 'When creating an account, send the new user a link to set their password', 'woocommerce' ), + 'title' => __( 'Account creation options', 'woocommerce' ), + 'desc' => __( 'Send password setup link (recommended)', 'woocommerce' ), + 'desc_tip' => __( 'New customers receive an email to set up their password.', 'woocommerce' ), 'id' => 'woocommerce_registration_generate_password', 'default' => 'yes', 'type' => 'checkbox', @@ -118,7 +126,7 @@ class WC_Settings_Accounts extends WC_Settings_Page { 'id' => 'woocommerce_erasure_request_removes_download_data', 'type' => 'checkbox', 'default' => 'no', - 'checkboxgroup' => 'end', + 'checkboxgroup' => '', 'autoload' => false, ), array( @@ -127,7 +135,7 @@ class WC_Settings_Accounts extends WC_Settings_Page { 'desc_tip' => __( 'Adds an option to the orders screen for removing personal data in bulk. Note that removing personal data cannot be undone.', 'woocommerce' ), 'id' => 'woocommerce_allow_bulk_remove_personal_data', 'type' => 'checkbox', - 'checkboxgroup' => 'start', + 'checkboxgroup' => 'end', 'default' => 'no', 'autoload' => false, ), @@ -229,10 +237,49 @@ class WC_Settings_Accounts extends WC_Settings_Page { ), ); - return apply_filters( - 'woocommerce_' . $this->id . '_settings', - $account_settings - ); + /** + * Filter account settings. + * + * @hook woocommerce_account_settings + * @since 3.5.0 + * @param array $account_settings Account settings. + */ + return apply_filters( 'woocommerce_' . $this->id . '_settings', $account_settings ); + } + + /** + * Output the HTML for the settings. + */ + public function output() { + parent::output(); + + // The following code toggles disabled state on the account options based on other values. + ?> + + { expect.arrayContaining( [ expect.objectContaining( { id: 'woocommerce_enable_guest_checkout', - label: 'Guest checkout', - description: - 'Allow customers to place orders without an account', + label: 'Checkout', + description: 'Enable guest checkout (recommended)', type: 'checkbox', default: 'yes', value: 'yes', @@ -1348,8 +1347,7 @@ test.describe.serial( 'Settings API tests: CRUD', () => { expect.objectContaining( { id: 'woocommerce_enable_checkout_login_reminder', label: 'Login', - description: - 'Allow customers to log into an existing account during checkout', + description: 'Enable log-in during checkout', type: 'checkbox', default: 'no', value: 'no', @@ -1361,8 +1359,7 @@ test.describe.serial( 'Settings API tests: CRUD', () => { expect.objectContaining( { id: 'woocommerce_enable_signup_and_login_from_checkout', label: 'Account creation', - description: - 'Allow customers to create an account during checkout', + description: 'During checkout', type: 'checkbox', default: 'no', value: 'no', @@ -1373,9 +1370,8 @@ test.describe.serial( 'Settings API tests: CRUD', () => { expect.arrayContaining( [ expect.objectContaining( { id: 'woocommerce_enable_myaccount_registration', - label: '', - description: - 'Allow customers to create an account on the "My account" page', + label: 'Account creation', + description: 'On "My account" page', type: 'checkbox', default: 'no', value: 'no', @@ -1386,9 +1382,9 @@ test.describe.serial( 'Settings API tests: CRUD', () => { expect.arrayContaining( [ expect.objectContaining( { id: 'woocommerce_registration_generate_username', - label: '', + label: 'Account creation options', description: - 'When creating an account, automatically generate an account username for the customer based on their name, surname or email', + 'Use email address as account login (recommended)', type: 'checkbox', default: 'yes', value: 'yes', @@ -1399,9 +1395,8 @@ test.describe.serial( 'Settings API tests: CRUD', () => { expect.arrayContaining( [ expect.objectContaining( { id: 'woocommerce_registration_generate_password', - label: '', - description: - 'When creating an account, send the new user a link to set their password', + label: 'Account creation options', + description: 'Send password setup link (recommended)', type: 'checkbox', default: 'yes', value: 'yes',