• Resolved kullussteve

    (@kullussteve)


    Hi,

    Want to hide the word “Billing” from checkout page error messages. Tried the code (below), but it will break the page (added to child theme function.php). Any suggestions?

    function customize_wc_errors( $error ) {
    if ( strpos( $error, ‘Billing ‘ ) !== false ) {
    $error = str_replace(“Billing “, “”, $error);
    }
    return $error;
    }
    add_filter( ‘woocommerce_add_error’, ‘customize_wc_errors’ );

    In this line: $error = str_replace(“Billing “, “”, $error);

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • linux4me2

    (@linux4me2)

    It looks like you’ve got fancy quotes in that line, which might cause an error, though it would help if you post the actual error message.

    Give this one a try by substituting it for that line in your code snippet:

    
    $error = str_replace('Billing ', '', $error);
    
    Thread Starter kullussteve

    (@kullussteve)

    found the solution what works from https://stackoverflow.com/questions/40038028/woocommerce-remove-billing-word-from-the-error-message:

    function customize_wc_errors( $error ) {
    if ( strpos( $error, ‘Billing ‘ ) !== false ) {
    $error = str_replace(“Billing “, “”, $error);
    }
    return $error;
    }
    add_filter( ‘woocommerce_add_error’, ‘customize_wc_errors’ );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to remove “Billing” from checkout page error messages’ is closed to new replies.