is_checkout_pay_page()
Checks if the current page is the order payment page. Conditional tag.
Uses: is_checkout()
No Hooks.
Returns
true|false.
Usage
is_checkout_pay_page();
Examples
#1 Check the order payment page
if ( is_checkout_pay_page() ) {
// order payment page
}
is_checkout_pay_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;
}