Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woogists/d600201444d61025d8e9fabf897c936f to your computer and use it in GitHub Desktop.
Save woogists/d600201444d61025d8e9fabf897c936f to your computer and use it in GitHub Desktop.
[WooCommerce Ninja Forms Product Add-ons] Hide price add-ons equal to zero
/*
* Snippet to hide price add-ons equal to zero.
* Code goes in the functions.php file in your theme.
*/
add_filter( 'wc_nf_addons_format_cart_item_price' , 'wc_ninja_forms_hide_zero_price' );
function wc_ninja_forms_hide_zero_price( $value ) {
$hide_price = ' (' . wc_price( '0.00' ) . ')';
if ( $value == $hide_price ) {
return '';
} else {
return $value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment