not guaranteed. */ public function flag_abandoned_cart_recovery_enabled_notice( $feature_id, $is_enabled ): void { if ( 'abandoned_cart_recovery' === $feature_id && $is_enabled ) { set_transient( 'wc_abandoned_cart_recovery_enabled_notice', 'yes', MINUTE_IN_SECONDS ); } } /** * 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. * * @internal For exclusive usage of WooCommerce core, backwards compatibility not guaranteed. */ 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§ion=wc_email_customer_abandoned_cart_recovery' ); printf( '

%1$s %3$s

', esc_html__( 'Abandoned cart recovery is enabled.', 'woocommerce' ), esc_url( $settings_url ), esc_html__( 'Configure the recovery email →', 'woocommerce' ) ); } /** * Check if the email improvements feature is enabled in preview mode in Settings > Emails. * This is used to force the email improvements feature without affecting shoppers. * * @param string $feature_id The feature id. * @return bool Whether the email improvements feature is enabled in preview mode. */ private function is_preview_email_improvements_enabled( string $feature_id ): bool { if ( 'email_improvements' !== $feature_id ) { return false; } /** * This filter is documented in templates/emails/email-styles.php * * @since 9.9.0 * @param bool $is_email_preview Whether the email is being previewed. */ $is_email_preview = apply_filters( 'woocommerce_is_email_preview', false ); if ( $is_email_preview ) { return get_transient( EmailPreview::TRANSIENT_PREVIEW_EMAIL_IMPROVEMENTS ) === 'yes'; } return false; } }