Automattic\WooCommerce\Internal\Features

FeaturesController::maybe_render_abandoned_cart_recovery_enabled_noticepublicWC 1.0

Render a success notice after the merchant enables Abandoned cart recovery, pointing them straight at the email settings page where they actually configure it.

Hooks into woocommerce_settings_advanced at priority 1, which fires inside the settings template right after WC_Admin_Settings::show_messages() (the "Your settings have been saved." notice) and before the form fields. That places our notice in the same visual slot below the tabs, alongside the standard save confirmation.

WC_Admin_Settings::add_message() would be the cleaner API but escapes its input via esc_html(), which strips the link tag. Direct echo here keeps the markup intact while still matching the surrounding notice style.

Method of the class: FeaturesController{}

No Hooks.

Returns

null. Nothing (null).

Usage

$FeaturesController = new FeaturesController();
$FeaturesController->maybe_render_abandoned_cart_recovery_enabled_notice(): void;

FeaturesController::maybe_render_abandoned_cart_recovery_enabled_notice() code WC 11.0.0

public function maybe_render_abandoned_cart_recovery_enabled_notice(): void {
	if ( 'yes' !== get_transient( 'wc_abandoned_cart_recovery_enabled_notice' ) ) {
		return;
	}
	delete_transient( 'wc_abandoned_cart_recovery_enabled_notice' );

	$settings_url = admin_url( 'admin.php?page=wc-settings&tab=email&section=wc_email_customer_abandoned_cart_recovery' );

	printf(
		'<div id="wc-abandoned-cart-recovery-enabled-notice" class="updated inline"><p><strong>%1$s <a href="%2$s">%3$s</a></strong></p></div>',
		esc_html__( 'Abandoned cart recovery is enabled.', 'woocommerce' ),
		esc_url( $settings_url ),
		esc_html__( 'Configure the recovery email →', 'woocommerce' )
	);
}