is_checkout_pay_page()WC 1.0

Checks if the current page is the order payment page. Conditional tag.

No Hooks.

Returns

true|false.

Usage

is_checkout_pay_page();

Examples

0

#1 Check the order payment page

if ( is_checkout_pay_page() ) {
	// order payment page
}

is_checkout_pay_page() code WC 10.8.1

function is_checkout_pay_page( bool $use_query_params = false ): bool {
	global $wp;

	// Use-case: attempt to identify the page based on global variables.
	if ( ! empty( $wp->query_vars['order-pay'] ) && is_checkout() ) {
		return true;
	}

	// Use-case: check for the presence of a specific query parameter when globals are not available.
	if ( $use_query_params ) {
		return isset( $_GET['pay_for_order'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
	}

	return false;
}