PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, July 4, 2022

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

 July 04, 2022     hook-woocommerce, paypal, php, woocommerce, wordpress     No comments   

Issue

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



Answered By - Ruvee
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing