Created
February 15, 2025 15:46
-
-
Save plugin-republic/ce861579f9c37df125d052e78ea21f5b 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 | |
/** | |
* Hide products with specific IDs | |
* Edit line 7 with the IDs you want to hide prices for | |
*/ | |
add_filter( ‘woocommerce_get_price_html’, function( $price, $product ) { | |
if( is_admin() ) return $price; | |
$product_ids = array( 1234, 5678 ); | |
if( in_array( $product->get_id(), $product_ids ) ) { | |
return ''; | |
} | |
return $price; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment