WordPress at Your Fingertips
function is not described

WC_Query::get_endpoint_title() public WC 2.3.0

Get page title for an endpoint.

{} It's a method of the class: WC_Query{}

Return

String. The page title.

Usage

$WC_Query = new WC_Query();
$WC_Query->get_endpoint_title( $endpoint, $action );
$endpoint(string) (required)
Endpoint key.
$action(string)
Optional action or variation within the endpoint.
Default: ''

Changelog

Since 2.3.0 Introduced.
Since 4.6.0 Added $action parameter.

Code of WC_Query::get_endpoint_title() WC 5.6.0

public function get_endpoint_title( $endpoint, $action = '' ) {
	global $wp;

	switch ( $endpoint ) {
		case 'order-pay':
			$title = __( 'Pay for order', 'woocommerce' );
			break;
		case 'order-received':
			$title = __( 'Order received', 'woocommerce' );
			break;
		case 'orders':
			if ( ! empty( $wp->query_vars['orders'] ) ) {
				/* translators: %s: page */
				$title = sprintf( __( 'Orders (page %d)', 'woocommerce' ), intval( $wp->query_vars['orders'] ) );
			} else {
				$title = __( 'Orders', 'woocommerce' );
			}
			break;
		case 'view-order':
			$order = wc_get_order( $wp->query_vars['view-order'] );
			/* translators: %s: order number */
			$title = ( $order ) ? sprintf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ) : '';
			break;
		case 'downloads':
			$title = __( 'Downloads', 'woocommerce' );
			break;
		case 'edit-account':
			$title = __( 'Account details', 'woocommerce' );
			break;
		case 'edit-address':
			$title = __( 'Addresses', 'woocommerce' );
			break;
		case 'payment-methods':
			$title = __( 'Payment methods', 'woocommerce' );
			break;
		case 'add-payment-method':
			$title = __( 'Add payment method', 'woocommerce' );
			break;
		case 'lost-password':
			if ( in_array( $action, array( 'rp', 'resetpass', 'newaccount' ), true ) ) {
				$title = __( 'Set password', 'woocommerce' );
			} else {
				$title = __( 'Lost password', 'woocommerce' );
			}
			break;
		default:
			$title = '';
			break;
	}

	/**
	 * Filters the page title used for my-account endpoints.
	 *
	 * @since 2.6.0
	 * @since 4.6.0 Added $action parameter.
	 *
	 * @see get_endpoint_title()
	 *
	 * @param string $title Default title.
	 * @param string $endpoint Endpoint key.
	 * @param string $action Optional action or variation within the endpoint.
	 */
	return apply_filters( 'woocommerce_endpoint_' . $endpoint . '_title', $title, $endpoint, $action );
}