Automattic\WooCommerce\Internal\StockNotifications\Admin

SettingsController::add_customer_stock_notifications_settingspublicWC 1.0

Add the Customer Stock Notifications settings.

Method of the class: SettingsController{}

Returns

Array. New settings.

Usage

$SettingsController = new SettingsController();
$SettingsController->add_customer_stock_notifications_settings( $settings, $section_id );
$settings(array) (required)
Original settings.
$section_id(string) (required)
Settings section identifier.

SettingsController::add_customer_stock_notifications_settings() code WC 10.3.6

public function add_customer_stock_notifications_settings( $settings, $section_id ) {

	if ( ! is_array( $settings ) ) {
		return $settings;
	}

	if ( 'customer_stock_notifications' !== $section_id ) {
		return $settings;
	}

	/**
	 * Filter the Customer Stock Notifications settings.
	 *
	 * @since 10.2.0
	 *
	 * @param array $default_customer_stock_notifications_settings The default Customer Stock Notifications settings.
	 */
	$stock_notification_settings = apply_filters(
		'woocommerce_customer_stock_notifications_settings',
		array(

			array(
				'title' => __( 'Customer stock notifications', 'woocommerce' ),
				'type'  => 'title',
				'desc'  => '',
				'id'    => 'product_customer_stock_notifications_options',
			),

			array(
				'title'   => __( 'Allow sign-ups', 'woocommerce' ),
				'desc'    => __( 'Let customers sign up to be notified when products in your store are restocked.', 'woocommerce' ),
				'id'      => 'woocommerce_customer_stock_notifications_allow_signups',
				'default' => 'no',
				'type'    => 'checkbox',
			),

			array(
				'title'   => __( 'Require double opt-in to sign up', 'woocommerce' ),
				'desc'    => __( 'To complete the sign-up process, customers must follow a verification link sent to their e-mail after submitting the sign-up form.', 'woocommerce' ),
				'id'      => 'woocommerce_customer_stock_notifications_require_double_opt_in',
				'default' => 'no',
				'type'    => 'checkbox',
			),

			array(
				'title'   => __( 'Delete unverified notification sign-ups after (in days)', 'woocommerce' ),
				'desc'    => __( 'Controls how long the plugin will store unverified notification sign-ups in the database. Enter zero, or leave this field empty if you would like to store expired sign-up requests indefinitey.', 'woocommerce' ),
				'id'      => 'woocommerce_customer_stock_notifications_unverified_deletions_days_threshold',
				'default' => Config::get_unverified_deletion_days_threshold(),
				'type'    => 'number',
			),

			array(
				'title'           => __( 'Guest sign-up', 'woocommerce' ),
				'desc'            => __( 'Customers must be logged in to sign up for stock notifications.', 'woocommerce' ),
				'id'              => 'woocommerce_customer_stock_notifications_require_account',
				'default'         => 'no',
				'type'            => 'checkbox',
				'desc_tip'        => __( 'When enabled, guests will be redirected to a login page to complete the sign-up process.', 'woocommerce' ),
				'checkboxgroup'   => 'start',
				'hide_if_checked' => 'option',
			),

			array(
				'desc'            => __( 'Create an account when guests sign up for stock notifications.', 'woocommerce' ),
				'id'              => 'woocommerce_customer_stock_notifications_create_account_on_signup',
				'default'         => 'no',
				'type'            => 'checkbox',
				'checkboxgroup'   => 'end',
				'hide_if_checked' => 'yes',
				'autoload'        => true,
			),

			array(
				'type' => 'sectionend',
				'id'   => 'product_customer_stock_notifications_options',
			),
		)
	);

	$settings = array_merge( $settings, $stock_notification_settings );

	return $settings;
}