Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation

Status::render_account_notice()protectedWC 1.0

If the user associated with the order needs to set a password (new account) show a notice.

Method of the class: Status{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->render_account_notice( $order );
$order(\WC_Order|null)
Order object.
Default: null

Status::render_account_notice() code WC 9.4.2

protected function render_account_notice( $order = null ) {
	if ( $order && $order->get_customer_id() && 'store-api' === $order->get_created_via() ) {
		$nag      = get_user_option( 'default_password_nag', $order->get_customer_id() );
		$generate = filter_var( get_option( 'woocommerce_registration_generate_password', false ), FILTER_VALIDATE_BOOLEAN );

		if ( $nag && $generate ) {
			return wc_print_notice(
				sprintf(
					// translators: %s: site name.
					__( 'Your account with %s has been successfully created. We emailed you a link to set your account password.', 'woocommerce' ),
					esc_html( wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) )
				),
				'notice',
				array(),
				true
			);
		}
	}
	return '';
}