Last active
December 16, 2024 16:23
-
-
Save samueleastdev/5a4eef2d653522d7671e2fd5af9654f3 to your computer and use it in GitHub Desktop.
Easily Extend Woocommerce Account Page With Custom Menu And Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function streamium_add_watchlist_endpoint() { | |
add_rewrite_endpoint( 'watchlist', EP_ROOT | EP_PAGES ); | |
} | |
add_action( 'init', 'streamium_add_watchlist_endpoint' ); | |
function streamium_account_query_vars( $vars ) { | |
$vars[] = 'watchlist'; | |
return $vars; | |
} | |
add_filter( 'query_vars', 'streamium_account_query_vars', 0 ); | |
function streamium_add_watchlist_link_my_account( $items ) { | |
$items['watchlist'] = 'Watchlist'; | |
return $items; | |
} | |
add_filter( 'woocommerce_account_menu_items', 'streamium_add_watchlist_link_my_account' ); | |
function streamium_watchlist_content() { | |
echo '<h3>Premium WooCommerce Support</h3><p>Welcome to the WooCommerce support area. As a premium customer, you can submit a ticket should you have any WooCommerce issues with your website, snippets or customization. <i>Please contact your theme/plugin developer for theme/plugin-related support.</i></p>'; | |
} | |
add_action( 'woocommerce_account_watchlist_endpoint', 'streamium_watchlist_content' ); | |
// Remove this but you will need to flush rewrite rules to get this to work. | |
flush_rewrite_rules(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment