New endpoint in my account gives 404 Error Woocommerce 3.6.5 and WP 5.2.2

Make sure you flush/re-save your settings in Permalinks > Settings whenever you add code the adds a rewrite endpoint or rule.

Also, the most up to date and optimal way to add an account endpoint in WooCommerce would be to use the woocommerce_get_query_vars filter:

/**
 * Register support endpoint.
 *
 * @param array $query_vars WooCommerce query vars.
 */
function wpse_343129_query_vars( $query_vars ) {
    $query_vars['support']   = 'support';

    return $query_vars;
}
add_filter( 'woocommerce_get_query_vars', 'wpse_343129_query_vars' );

It saves you having to use 2 separate functions, and ensures that you can use filters like woocommerce_endpoint_support_title to properly update the account page title:

/**
 * Support account page endpoint title.
 *
 * @param string $title Endpoint title.
 * @param string $endpoint Current endpoint.
 */
function wpse_343129_support_endpoint_title( $title, $endpoint ) {
    return 'Support';
}
add_filter( 'woocommerce_endpoint_support_title', 'wpse_343129_support_endpoint_title', 10, 2 );

Leave a Comment