Created
March 9, 2018 15:14
-
-
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
This file contains 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
/* | |
* 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