Skip to content
Advertisement

Change WooCommerce Order pay page title

Attempting to change the title of the “pay for order” page / “customer payment page”

https://url.com/checkout/order-pay/753/?pay_for_order=true&key=wc_order_xxxxxx

Below is not currently working, it is modified from changing the title on the thank you page.

add_filter( 'the_title', 'woo_title_pay_order', 10, 2 );

function woo_title_pay_order( $title, $id ) {
if ( function_exists( 'is_pay_for_order_page' ) && 
     is_pay_for_order_page() && get_the_ID() === $id ) {
    $title = "Checkout";
}
return $title;

}

Advertisement

Answer

Updated

You can use the following to change “Pay for order” page title:

add_filter( 'the_title', 'change_pay_for_order_title' );
function change_pay_for_order_title( $title ) {
    if ( is_wc_endpoint_url( 'order-pay' ) ) {
        return __('Checkout', 'woocommerce');
    }
    return $title;
}

Or also the following code based on ‘order-pay’ endpoint (but changes the breadcrumb):

add_filter( 'woocommerce_endpoint_order-pay_title', 'change_checkout_order_pay_title' );
function change_checkout_order_pay_title( $title ) {
    return __( "Checkout", "woocommerce" );
}

Code goes in functions.php file of the active child theme (or active theme). Tested and works.

Related: Set My Account custom items endpoints titles in WooCommerce

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement