Skip to content

Instantly share code, notes, and snippets.

@bradleysa
Created April 22, 2022 07:58
Show Gist options
  • Save bradleysa/c8f099408d417da58cb538e452f19414 to your computer and use it in GitHub Desktop.
Save bradleysa/c8f099408d417da58cb538e452f19414 to your computer and use it in GitHub Desktop.
WC: Disable WooCommerce From: $$ Price
function patricks_custom_variation_price( $price, $product ) {
$target_product_types = array(
'variable'
);
if ( in_array ( $product->product_type, $target_product_types ) ) {
// if variable product return and empty string
return '';
}
// return normal price
return $price;
}
add_filter('woocommerce_get_price_html', 'patricks_custom_variation_price', 10, 2);
/** http://speakinginbytes.com/2013/11/disable-from-price/ **/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment