Create a Ninja Form
↑ Back to topCreating a New Form
↑ Back to topCreate a Product
↑ Back to topUsage
↑ Back to topCustomization
↑ Back to topNote: This is a Developer level section. If you are unfamiliar with code and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our Support Policy.
Hide price add-ons equal to zero
↑ Back to top
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; | |
} | |
} |
Hide all sub-prices
↑ Back to top
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 all sub prices | |
* Code goes in the functions.php file in your theme. | |
*/ | |
add_filter( 'wc_nf_addons_cart_option', 'wc_ninja_forms_price' ); | |
function wc_ninja_forms_price( $display ) { | |
return ''; | |
} |