• Hey everyone

    I’m using Woocommerce Ninja Forms Product Add Ons, and I want to hide the text and input field added to the product when addon cost = 0.00.

    I have the below code for removing just the “0.00” part, but I want the string related to all free addons/variations to be removed as well.

    In that way, the result should be that only the product name and price and all extra add ons that are not free, show up on the checkout, thankyou and order email.

    As far as I can understand, I need to hook into some function placed in templates/cart/cart-item-data.php and maybe templates/order/order-details-item.php, but I’m not sure how?

    Anybody have a great or maybe simple fix (or both) to put in the child themes functions.php?

    Heres the code for removing the “0.00” part only from the order:

    <?php

    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;
    }

    }

    Looking forward to hear from you

  • The topic ‘WoocommerceNinjaForms – Hide text and input field when addon cost = 0.00’ is closed to new replies.