Automattic\WooCommerce\Internal\StockNotifications\Admin
SettingsController::output_admin_notices
Display admin notices about incompatible settings combinations.
Method of the class: SettingsController{}
No Hooks.
Returns
null. Nothing (null).
Usage
$SettingsController = new SettingsController(); $SettingsController->output_admin_notices();
SettingsController::output_admin_notices() SettingsController::output admin notices code WC 10.3.6
public function output_admin_notices() {
// Only show notices on the Customer Stock Notifications settings page.
$screen = get_current_screen();
if ( ! $screen || 'woocommerce_page_wc-settings' !== $screen->id || ! isset( $_GET['section'] ) || 'customer_stock_notifications' !== $_GET['section'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
return;
}
if ( 'no' === get_option( 'woocommerce_registration_generate_password', 'no' ) && 'yes' === get_option( 'woocommerce_customer_stock_notifications_create_account_on_signup', 'no' ) ) {
wp_admin_notice(
sprintf(
/* translators: %s settings page link */
__( 'WooCommerce is currently <a href="%s">configured</a> to create new accounts without generating passwords automatically. Guests who sign up to receive stock notifications will need to reset their password before they can log into their new account.', 'woocommerce' ),
esc_url( admin_url( 'admin.php?page=wc-settings&tab=account' ) )
),
array(
'id' => 'message',
'type' => 'warning',
'dismissible' => false,
)
);
}
if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) && Config::allows_signups() ) {
wp_admin_notice(
sprintf(
/* translators: %s settings page link */
__( 'WooCommerce is currently <a href="%s">configured</a> to hide out-of-stock products from your catalog. Customers will not be able sign up for back-in-stock notifications while this option is enabled.', 'woocommerce' ),
esc_url( admin_url( 'admin.php?page=wc-settings&tab=products§ion=inventory' ) )
),
array(
'id' => 'message',
'type' => 'warning',
'dismissible' => false,
)
);
}
}