Automattic\WooCommerce\Internal\StockNotifications\Frontend

ProductPageIntegration::render_formprivateWC 1.0

Render the form.

Method of the class: ProductPageIntegration{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->render_form( $product ): void;
$product(WC_Product) (required)
Product object.

ProductPageIntegration::render_form() code WC 10.3.6

private function render_form( WC_Product $product ): void {

	// Check if requires account.
	if ( Config::requires_account() && ! is_user_logged_in() ) {
		$this->display_account_required( $product );
		return;
	}

	// Check if already signed up.
	if ( $this->is_personalization_enabled() && is_user_logged_in() ) {
		$user         = \get_user_by( 'id', \get_current_user_id() );
		$notification = $this->signup_service->is_already_signed_up( $product->get_id(), $user->ID, $user->user_email );
		if ( $notification instanceof Notification ) {
			$this->display_already_signed_up( $product, $notification );
			return;
		}
	}

	$this->display_form( $product );
}