Create a Ninja Form
↑ Volver al principioCreating a New Form
↑ Volver al principioCreate a Product
↑ Volver al principioUsage
↑ Volver al principioCustomization
↑ Volver al principioNote: 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
↑ Volver al principio
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
↑ Volver al principio
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 ''; | |
} |