Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
These snippets work together to allow us to add custom WooCommerce account menu links to any URL. See https://hookturn.io/add-custom-woocommerce-account-menu-links/ for more detail.
<?php
add_filter( 'woocommerce_get_endpoint_url', function ( $url, $endpoint, $value, $permalink ) {
if ( $endpoint === 'my-courses' ) {
$url = home_url( 'my-courses' );
}
return $url;
}, 10, 4 );
<?php
add_filter( 'woocommerce_account_menu_items', function ( $items, $endpoints ) {
$items['my-courses'] = 'My Courses';
return $items;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment