• Resolved wpseriouslee

    (@wpseriouslee)


    I’m trying to override the Postcode field on my checkout form, I’ve managed to hook in and override the other fields apart from poscode

    
    function custom_override_checkout_fields( $fields ) {
      $fields['billing']['billing_first_name']['label'] = 'NAME';
      $fields['billing']['billing_first_name']['placeholder'] = 'NAME';
    
      $fields['billing']['shipping_postcode']['label'] = 'POSTCODE';
      $fields['billing']['shipping_postcode']['placeholder'] = 'POSTCODE';
    
      return $fields;
    }
    
    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields');
    

    When I load the form, there is a split second when the label changes to POSTCODE then it shifts back to the default Postcode; I’ve tried changing the default address fields as well but no juice; even with trying the default address fields, it doesn’t event show the content of the postcode key, it prioritises the one from checkout_fields

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

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

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @wpseriouslee!

    Try using the gettext filter like so and see if that helps:

    function my_text_strings( $translated_text, $text, $domain ) {
        switch ( $translated_text ) {
            case 'ZIP' :
                $translated_text = __( 'test', 'woocommerce' );
                break;
        }
        return $translated_text;
    }
    add_filter( 'gettext', 'my_text_strings', 20, 3 );

    Cheers!

    Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Howdy!

    We haven’t heard back from you in a while, so I’m going to go ahead and mark this thread as resolved. If you have any other questions please start a new thread.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot override checkout form label’ is closed to new replies.