Automattic\WooCommerce\Internal\StockNotifications\Admin

SettingsController::output_admin_notices │ public │ WC 1.0

Display admin notices about incompatible settings combinations.

Method of the class: SettingsController{}

No Hooks.

Returns

void. Nothing (null).

Usage

$SettingsController = new SettingsController();
$SettingsController->output_admin_notices();

SettingsController::output_admin_notices() code WC 11.2.1

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 ( '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&section=inventory' ) )
			),
			array(
				'id'          => 'message',
				'type'        => 'warning',
				'dismissible' => false,
			)
		);
	}
}