Last active
November 22, 2021 02:28
-
-
Save NickGreen/80d0ff746fe43da85be5f015a48ccfd4 to your computer and use it in GitHub Desktop.
Turn off switching for specific user role
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if (is_account_page()) { | |
| $user = wp_get_current_user(); | |
| if ( in_array( 'EXAMPLE_ROLE', (array) $user->roles ) ) { | |
| add_filter( 'woocommerce_subscriptions_can_item_be_switched', '__return_false', 100 ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the code we made which works on our site.