Created
February 18, 2025 17:07
-
-
Save plugin-republic/60a474128129967ec7b3a73d2ca741d6 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Filter product if user not logged in | |
*/ | |
function pr_demo_is_purchasable( $purchasable, $product ) { | |
if( !is_user_logged_in() ) { | |
return false; | |
} | |
return $purchasable; | |
} | |
add_filter( 'woocommerce_is_purchasable', 'pr_demo_is_purchasable', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment