Reputation: 393
Hi i have a woocommerce site with only billing details, so i dont really need the "https://www.lawrence.dk/my-account/edit-address/" link, i would rather it went directly to https://www.lawrence.dk/my-account/edit-address/billing/ however i cant seem to find any way to do so.
How do i edit the myaccount navigation link so it goes directly to that instead?
Upvotes: 2
Views: 293
Reputation: 29624
There you go
function filter_woocommerce_get_endpoint_url( $url, $endpoint, $value, $permalink ) {
// DEBUG INFO (uncomment if needed)
//echo '<pre> 1. ', print_r($url, 1), '</pre>';
//echo '<pre> 2. ', print_r($endpoint, 1), '</pre>';
//echo '<pre> 3. ', print_r($value, 1), '</pre>';
//echo '<pre> 4. ', print_r($permalink, 1), '</pre>';
if( $endpoint === 'edit-address' ) {
// Custom URL
$url = site_url() . '/my-account/edit-address/billing/';
}
return $url;
}
add_filter( 'woocommerce_get_endpoint_url', 'filter_woocommerce_get_endpoint_url', 10, 4 );
Upvotes: 2