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
- Add another user role based on a defined input field in WordPress (Woocommerce)
- Removing unwanted role after purchase
- How to add a new endpoint in woocommerce
- Slow Loading Attribute Select – WooCommerce Backend
- How can I define a custom template for woocommerce [products] shortcode? [closed]
- Display orders instead of woocommerce my account dashboard for logged in users [closed]
- Detect whether a page is a product subcategory page?
- Get WooCommerce Email Classes in Backend
- Use Hooks to Limit One Comment Per User Per Post – Hide Form if Already Commented
- Display Categories Assigned to a WooCommerce Product
- WooCommerce is slow with many categories [closed]
- Get current WooCommerce endpoint not working
- Changing Woocommerce price display [closed]
- Which WooCommerce hook do I need to use to place the coupon field after the checkout sidebar
- How to remove recurring totals information for a particular subscription product? [closed]
- WordPress codex: apply_filters – clarification on creating a new hook on the fly. How do we use it?
- WooCommerce Cart – Group Products By Category
- Set a default quantity input value for a variable product category in WooCommerce
- WooCommerce product sorting VERY slow
- WooCommerce change price in cart [closed]
- Categories not shown in admin after adding woocommerce products via wp wc cli
- Woocommerce – Move product without price a the end
- Enabling autosave when plugin disabled
- WooCommerce email text based on category && shipping zone && payment method [closed]
- How to get all attributes with their terms related to specific Woocommerce product category [closed]
- woocommerce – get_image_size() deprecated [closed]
- Extra row / text field to a product page (WooCommerce)
- woocommerce_email_attachments filter arguments [closed]
- Problem with cURL and rest API
- Child theme dosn’t overwrite WooCommerce (version 3.4.7)
- How to Show Single Product – 4 Data by ID in Custom Page without over-riding the existing Woo-Commerce
- WOOCommerce redirect after registration to account details
- How can I add an additional action button into the woocommerce admin order page?
- Avada & WooCommerce Customization – Replacing product_title in woo-config.php [closed]
- How to add a custom text for order confirmation email template woocommerce
- WooCommerce template page for category
- woocomerce is serving OR Relation instead of AND on taxonomy product_tag
- Woocommerce Subscriptions – Set Billing Interval/Period
- WooCommerce with ACF: custom fields per product variation
- Woocommerce checkout page reload on up dating shipping method
- change wp_login url and redirect users at the same time
- How to clear woocommerce checkout form after pageload
- Is there a plugin available for recurring orders in Woocommerce? [closed]
- Woocommerce PHP site that shows table with orders from specific category
- How to get the webshop page in 2:nd language, with Polylang and Hyyan
- Subcategories not working when using shared base with custom taxonomy
- call_user_func_array() error in class-wp-hook.php
- Error after woocommerce update from 2.6 to 3.5 [closed]
- Send billing info from woocommerce checkout page to paypal checkout form
- Check if a category has a parent category in WooCommerce REST API
- Remove a higher quantity from stock according to a variation
- Auto generate user email while registration
- WooCommerce Cart Total Table chronology order change [closed]
- Woocommerce Update Order Notes Date
- Shipping Method does not inherit settings from the class
- My woocommerce checkout page and woocommerce setting page are not responding [closed]
- Woocommerce Shortcode custom orderby not working
- Switch position of short description and variations [closed]
- Allow add new post access to custom post but not wp post for some role