I have found/made the code that works. Maybe it helps somebody else.
/**
* Remove the "Upgrade or Downgrade" button from the My Subscription table if user role is "subscriber_plus".
*/
add_filter('woocommerce_subscriptions_switch_link', 'remove_switch_button', 10, 4);
function remove_switch_button($switch_link, $item_id, $item, $subscription) {
$user = wp_get_current_user();
if ( in_array( 'subscriber_plus', (array) $user->roles ) ) {
return '';
}
return $switch_link;
Related Posts:
- Correct function to get the user’s latest Woocommerce Subscription?
- Limit users to one active subscription in WooCommerce Subscriptions? [closed]
- In WooCommerce filter the available Payment Methods by User Role [closed]
- How do I add a “Cancel” button on the subscriptions listing page [closed]
- WooCommerce Subscriptions: Show monthly Price for annual Product
- Admin access for custom user capabilities
- How to get woocommerce subscription next payment date or date when subscription expires in woocommerce_subscription_renewal_payment_complete hook?
- Woocommerce Subscription Pricing/Billing Schedule
- WP_Query with meta_query for children
- WooCommerce limited role
- WooCommerce subscription, give option to prorate or not to prorate to user while switching subscription
- Subscription on Checkout
- How to subscribe free subscription on user registration in woocommerce subscription plugin?
- Tried to create a user role that can only edit user information, but my test account cannot view the dashboard. What am I missing?
- WooCommerce which roles and capabilities control user login re-direct to Woo Account Page?
- How to change a WooCommerce Subscription Deposit and Monthly Payment? [closed]
- WooCommerce Admin order – Only run action if user is loaded
- WooCommerce get_author_posts_url() – Author URL redirecting to shop base
- Synchronise Renewals on existing subscriptions [closed]
- WooCommerce Subscriptions: Hide one variation subscription
- I have 3 types of prices in WP and I need to change price for each specific user role using hooks
- Switch to user link shortcode
- wp-cron and woocommerce subscriptions killing performance
- How to show specific admin menu to specific user role?
- Assign user role by text field in WordPress (Woocommerce) [closed]
- Need help with woocommerce roles
- Applying pre-production modifications
- How to change user role after login?
- How to send welcome email once user buys the subscription
- How to apply a custom coupon to a WooCommerce Subscription recurring amount?
- Woocommerce customer role doesn’t change if user is already a subscriber [closed]
- How Do I Access Parameters Emitted by an Action?
- Changing second user role while updating/downgrading membership level – s2member [closed]
- How to add a menu page for options in wordpress for user that has the role of vendor?
- Restrict the shop_manager role to the WooCommerce Orders Page
- Edit woocommerce subscription email
- Can I remove WooCommerce specific product categories from shop managers?
- Membership website with discount on scheduled appointment
- How do I remove the recurring total from thank you for your order email?
- Question about WooCommerce Subscription
- I want to update shipping charge $0 for all Woocommeerce Subscription auto-renewal orders
- Select subscriber as author of post in admin panel?
- How to update user role without logout
- Add product attribute to Woocommerce’s blocks in Gutenberg
- The correct way to override WooCommerce product gallery from a plugin [closed]
- global $post; in WooCommerce
- Woocommerce template single-product.php in theme folder not working
- Problems adding in-store product managers
- differentiate hooks and filters on the same page [closed]
- Signup Form that adds customer to MailChimp, redirects to checkout, and fills in form data
- Automatically running Scheduled Actions
- Hook to use when customer placing order
- Woocommerce Rest Api Categories problem [closed]
- One file for all virtual, downloadable product variations [closed]
- Product queue for my subscription box
- Remove “?add-to-cart=product-id” from Add to Cart URL when on the Cart page
- How to show total amount on woocommerce?
- Disable Order Review Page when the id product
- Set both meta_query and tax_query using wp_query->set
- Problem with add_action
- Protecting WooCommerce Customizations with Update
- Setting WooCommerce SKU programmatically [closed]
- How to edit mobile view of my wordpress website without affecting the desktop view? [closed]
- WooCommerce: How to insert filtered attribute(s) in page title of archive?
- Multiple Pricing [closed]
- WOOF product filter prevent from loading on wordpress search result page
- Adding product on sale into specific category after creation
- How to select the first product variant as a default?
- WooCommerce – dynamically loading checkout page using ajax not showing payment methods for guest
- Pass values to ajax
- Send Email to Custom Field in Custom Post Type when order is Completed
- Fragments to Update Cart Counter not working on homepage – Woocommerce
- WooCommerce Review Author Hook on Review Submission
- Filter orders in Admin area based on logged in user
- Exclude Specific Product Category for showing up in its parent category page
- Add new page in WooCommerce My Account page
- Tags pages for different Custom Post Types and WooCommerce Products sharing Post Tags
- get_posts only getting most recent product
- How to only show featured products in wooCommerce using function.php function
- How to insert link, with lightbox, that opens specific page content only
- Vendor Listing by Location
- WordPress Woocommerce – Checkout – Error 405: Unable to create order. Please try again [closed]
- Fastest way to create product variations in WooCommerce?
- Creating a shortcode with a variable (Woocommerce)?
- dakon show vender address on checkout page
- Adding total_sales to Grouped Product within WooCommerce
- Woocommerce: how to make only certain products shippable?
- Customer email notification upon order update in woocommerce
- How can i hide a specific class when cart subtotal is above a certain amount
- Update WooCommerce Short Description using SQL
- acf_form() – “On Update” action [closed]
- Trying to insert a div ID link into Woocommerce shortcode Pagination
- Remove login fields from /customer-account page [closed]
- Set single product image (main image) and archive thumbnail image as different from each other in Woocommerce
- WooCommerce Simple Auction and delayed capture
- How do I fix this “Uncaught ReferenceError: woodmartThemeModule is not defined”?
- How can I solve WordPress error “Cannot load product_attributes” and “Cannot load product-reviews”?
- How to get all child categories of current parent category in product detail page of woocommerce? [closed]
- Mandatory Fields For WooCommerce Products Before Publishing
- In woo commerce , Products change back to “Draft” from “published” automatically after it is purchased on the woo commerce shop page.Theme WP rentals [closed]