Create WooCommerce Custom Accounts Page

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.

custom_woocommerce_accounts_page

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 .

Create WooCommerce Custom Page in Accounts Panel

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

 

WooCommerce Endpoints

Custom WooCommerce Plugin Development

Your one social media share will help others

Leave a Comment