0

I'm trying to add a button at the end of my WooCommerce MyAccount navigation:

enter image description here

I need this after "Konto-Details". I'll name the button "Konto löschen". So far so good. This is what I've tried:

add_filter ( 'woocommerce_account_menu_items', 'add_delete_account_button', 40 );
function add_delete_account_button( $menu_links ){

    $menu_links = array_slice( $menu_links, 0, 5, true ) 
    + array( 'delete-account' => 'Konto löschen' )
    + array_slice( $menu_links, 5, NULL, true );

    return $menu_links;

}

The problem is that this add a and not a . How can I do this? I don't want a link there, just a cute small button :'(.

  • what does the button do? is it a link or another menu ? if button just placing a html by modifying the template will be enough – Latheesh V M Villa Oct 16 '18 at 14:03
0

Try using a hook woocommerce_after_account_navigation:

add_action( 'woocommerce_after_account_navigation', 'wpse316838_add_button' );
function wpse316838_add_button() {
    echo '<button class="small cute">Small and cute button</button>';
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.