In this post I am going to show you how to create WooCommerce custom accounts page. We will create a new accounts tab and a page linked to it.
Create New Account Tab
We will create a new tab “CI Custom Endpoint” and assigned it to the items array. Our custom tab menu function will be hooked to woocommerce_account_menu_items. The logout menu tab is passed to unset() function because we want our Custom Tab before it. Later again Logout tab is added to the items array to display it in the end .
Flush Rewrite Rules
We need to register a new endpoint in WordPress using the add_rewrite_endpoint() function.
Also register it using the query_vars filter. Endpoints are an extra part in the site URL that detect and show different content of page.
Custom Accounts Page
In last step the ci_custom_endpoint_content() function includes custom page and is hooked to endpoint. The code within this function will display tabs data. You can add code directly to function or can add a custom page. The page my-custom-endpoint.php is added within theme directory, it can be added to custom plugin.
Add the following code to the functions.php file