Search code examples
phpwordpresswoocommercepaypalhook-woocommerce

How to remove "Paypal payments" tab from My Account in Woocommerce


The Woocommerce Paypal Payments plugin adds a "Paypal payments" tab on the Woocommerce My Account page. How do I remove this tab entirely?

I have tried this snippet modified from one found here but was unsuccessful in removing the tab.

add_filter ( 'woocommerce_account_menu_items', 'misha_remove_my_account_links' );
function misha_remove_my_account_links( $menu_links ){
        
  unset( $menu_links['ppcp-paypal-payment-tokens'] );
        
  return $menu_links;
        
}

Solution

  • You're on the right track! That plugin adds that tab on priority of 40. So, you could add a filter on a higher priority, let's say 50, like this:

    add_filter('woocommerce_account_menu_items', 'misha_remove_my_account_links', 50);
    
    function misha_remove_my_account_links($menu_links)
    {
    
        unset($menu_links['ppcp-paypal-payment-tokens']);
    
        return $menu_links;
    }
    

    And poof! That extra tab is gone!

    enter image description here