Automattic\WooCommerce\Internal\StockNotifications\Frontend

ProductPageIntegration::display_account_requiredpublicWC 1.0

Display the account required message.

Method of the class: ProductPageIntegration{}

Returns

null. Nothing (null).

Usage

$ProductPageIntegration = new ProductPageIntegration();
$ProductPageIntegration->display_account_required( $product ): void;
$product(WC_Product) (required)
Product object.

ProductPageIntegration::display_account_required() code WC 10.3.6

public function display_account_required( WC_Product $product ): void {

	/**
	 * Filter the account required message HTML.
	 *
	 * @since 10.2.0
	 *
	 * @param string|null $pre The message.
	 * @param WC_Product  $product Product object.
	 * @return string|null The message.
	 */
	$pre = apply_filters( 'woocommerce_customer_stock_notifications_account_required_message_html', null, $product );
	if ( ! is_null( $pre ) ) {
		echo wp_kses_post( $pre );
		return;
	}

	$text = __( 'Please {login_link} to sign up for stock notifications.', 'woocommerce' );
	$text = str_replace( '{login_link}', '<a href="' . wc_get_account_endpoint_url( 'my-account' ) . '">' . _x( 'log in', 'back in stock form', 'woocommerce' ) . '</a>', $text );
	wc_print_notice( $text, 'notice' );
}