Add a Custom Tab to the WooCommerce My Account Page
Registers a brand new endpoint (in this example, "Premium Support") and adds it as its own tab in the My Account menu, complete with its own content area — the standard pattern for extending My Account with anything WooCommerce doesn't ship by default.
/**
* Register new endpoint slug to use for My Account page
*/
/**
* @important-note Resave permalinks or it will give 404 error
*/
function woo_custom_add_premium_support_endpoint() {
add_rewrite_endpoint( 'premium-support', EP_ROOT | EP_PAGES );
}
add_action( 'init', 'woo_custom_add_premium_support_endpoint' );
/**
* Add new query var
*/
function woo_custom_premium_support_query_vars( $vars ) {
$vars[] = 'premium-support';
return $vars;
}
add_filter( 'woocommerce_get_query_vars', 'woo_custom_premium_support_query_vars', 0 );
/**
* Insert the new endpoint into the My Account menu
*/
function woo_custom_add_premium_support_link_my_account( $items ) {
$items['premium-support'] = 'Premium Support';
return $items;
}
add_filter( 'woocommerce_account_menu_items', 'woo_custom_add_premium_support_link_my_account' );
/**
* Add content to the new endpoint
*/
function woo_custom_premium_support_content() {
echo '<h3>Premium WooCommerce Support</h3><p>Welcome to the WooCommerce support area.</p>';
echo do_shortcode( ' /* your shortcode here */ ' );
}
/**
* @important-note "add_action" must follow 'woocommerce_account_{your-endpoint-slug}_endpoint' format
*/
add_action( 'woocommerce_account_premium-support_endpoint', 'woo_custom_premium_support_content' );
More WooCommerce snippets
Add a Custom Post Type Through WooCommerce
Lets a non-`product` post type behave like a purchasable WooCommerce item — pulling its price from a custom field and giving it a working "Add to Cart" button, without converting it into an actual Product post type.
Reorder (and Rename) the My Account Menu Tabs
Controls the exact order the tabs appear in on the WooCommerce My Account page, and lets you rename any of them at the same time — including slotting in a custom tab you've added elsewhere.
Shortcode: Show a Customer’s Purchase History as a Product Grid
Registers a `[my_products]` shortcode that looks up everything the logged-in customer has ever bought (completed or processing orders) and renders it as a normal WooCommerce product loop — useful for a "buy again" section on the My Account page.