• Resolved Tim Derouin

    (@tderouindesign)


    We have been using the following code in our functions.php file to show a custom message on the Billing Details page for a few months now without a problem:

    /*
    ______________________________________________
    WooCommerce billing address note BEGIN
    ______________________________________________
    
    */
    
    function wc_billing_field_strings( $translated_text, $text, $domain ) {
        switch ( $translated_text ) {
            case 'Billing details' :
                $translated_text = __( 'Billing details <br><span style="font-size:80%; line-height:20px; color: #F97F85;">Name and address <em>must</em> be consistent with cardholder name and billing address.</span>', 'woocommerce' );
                break;
        }
        return $translated_text;
    }
    add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
    
    /*
    ______________________________________________
    WooCommerce billing address note END
    ______________________________________________
    
    */

    However, updating to the latest version of WooCommerce causes the HTML to show rather than the formatted text seen here: https://www.levellerspress.com/checkout/ (be advised you will need to add something to your cart to see the Billing Details message in red).

    We have restored the previous version of WooCommerce and the message now appears again as intended.

    I tried changing the double quotes to single quotes in the code above but that made no difference. I assume the custom coding we have been using is no longer an option with the latest plugin update?

    Any guidance so we can update to the latest version of WooCommerce and keep our custom note is greatly appreciated. Thanks in advance!

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Looked good to me. I don’t see any HTML issue. Maybe you’re seeing cache?

    Thread Starter Tim Derouin

    (@tderouindesign)

    Thanks @serafinnyc!

    The HTML on the live page is not visible as I restored the previous version of WooCommerce. The note needs to be in red to avoid customers ignoring it. I prefer to not have the coding appear for now as customers may be worried there is a problem as a result, be reluctant to submit their payment information.

    It seems the coding I am using in functions.php is no longer supported in the latest release of WooCommerce so I am hoping to find updated code to maintain the red color.

    Thoughts?

    Thread Starter Tim Derouin

    (@tderouindesign)

    As a temporary fix, which may be the only answer, I have changed the functions.php code to:

    /*
    ______________________________________________
    WooCommerce billing address note BEGIN
    ______________________________________________
    
    */
    
    function wc_billing_field_strings( $translated_text, $text, $domain ) {
        switch ( $translated_text ) {
            case 'Billing details' :
                $translated_text = __( 'Billing details: Name and address must be consistent with cardholder name and billing address.', 'woocommerce' );
                break;
        }
        return $translated_text;
    }
    add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
    
    /*
    ______________________________________________
    WooCommerce billing address note END
    ______________________________________________
    
    */

    And then also added in the following CSS to make ti red:

    h3.woocommerce-billing-fields, .woocommerce-billing-fields h3 {
        color: #F97F85 !important;
    }

    It works but I would rather have the ability to include HTML in the functions.php coding.

    @tderouindesign is absolutely correct. I had added custom text with HTML for Billing details but the HTML code displays as text since last WC update.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom note showing as HTML after latest plugin update’ is closed to new replies.