Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Created February 15, 2025 15:46
Show Gist options
  • Save plugin-republic/ce861579f9c37df125d052e78ea21f5b to your computer and use it in GitHub Desktop.
Save plugin-republic/ce861579f9c37df125d052e78ea21f5b to your computer and use it in GitHub Desktop.
<?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