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)
- Taxclass based on certain conditions: location+userrole
- Removing unwanted role after purchase
- Woocommerce – Add a product to cart programmatically via JS or PHP [closed]
- ( Woocommerce) How to get the user belonging to an order? [closed]
- Get the product list of a given Category ID
- List of JS events in the WooCommerce frontend
- get woocommerce My account page link
- Select subscriber as author of post in admin panel?
- WooCommerce: How to edit the get_price_html
- Get woocommerce product price by id [closed]
- Product categories don’t appear as option to build menu
- WooCommerce Variable Product Price not showing on single product page
- Check IF is a “single product page” and Check the “role” for a Redirect
- How to override WooCommerce template files?
- Woocommerce add extra field to variation product
- Getting the gallery images from products in woocommerce?
- How to get current product category ID in product archive page
- Get url of product’s images (woocommerce)
- WooCommerce prices location in DB
- Order by rating not works in wp_query
- Woocommerce: How to remove page-title at the home/shop page but not category pages
- Woocommerce show cross sells on singe product page [closed]
- How to add a new endpoint in woocommerce
- Are there any hook or filter when refund is done through admin -woocommerce
- How to check if is in cart page? [closed]
- Display single product attribute value on Shop page (Woocommerce)
- WP/WooCommerce REST API cart/checkout/order [closed]
- how to use wc_create_order with subscription product
- WooCommerce: Webhook disabled on its own
- Share users and WooCommerce memberships between two installations
- Slow Loading Attribute Select – WooCommerce Backend
- WooCommerce: Can’t use wc_get_products for custom REST API endpoints
- How to change or add Woocommerce thank you page URL key content?
- How can I define a custom template for woocommerce [products] shortcode? [closed]
- How to remove an action within a class with extends
- single-product.php template not working for single products [closed]
- Insert variations via woocommerce api [closed]
- WooCommerce get physical store address
- Is it possible to add custom fields to a WooCommerce attribute term? [closed]
- wc_get_template_part( ‘content’, ‘product’ ) | Where is this file located?
- how to get woocommerce product attribute slug
- Move payment options at checkout in WooCommerce [closed]
- add_filter to modify woocommerce_cart_item_name hyperlink
- Where do the cart details are stored in database?
- How to update user role without logout
- How to display product price of the product in loop
- How to disable Woocommerce password recovery and use the default WordPress password reset page?
- Display order items names in WooCommerce admin orders list [closed]
- Is it safe to delete from db orphaned posts i.e. whose post_parent no longer exists?
- Attach a Custom Post Type to a Woocommerc product as a variation or add-on [closed]
- Add custom variable to cart content [closed]
- Get product details by url key in WordPress woocommerce
- Get product link
- WooCommerce – Hook after Loading Variation in Admin Edit page?
- How to delete woo commerce order pragmatically? [closed]
- WooCommerce changes lost password reset link
- Process checkout using WC REST API
- How to get rid of the hover zoom in WooCommerce single products