Created
July 23, 2018 22:48
-
-
Save NickGreen/e87cd1bafdce99f357cf9e167e7d6d6b to your computer and use it in GitHub Desktop.
turn_off_switching_per_product
This file contains 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 | |
add_filter('woocommerce_subscriptions_can_item_be_switched','turn_off_switching_per_product', 10, 3); | |
function turn_off_switching_per_product(){ | |
$turn_off_switching_for_these_products = array(10,24,438); // change this for whatever products you want to make not switchable | |
$product_id = wcs_get_canonical_product_id( $item ); | |
if (in_array($product_id, $turn_off_switching_for_these_products)) { | |
$item_can_be_switch = false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment