Unable to change checkout placeholder text

by cassiopeia   Last Updated May 15, 2019 15:08 PM

I am using woocommerce with storefront and on the checkout the placeholder text for address 1 is "street name" and address 2 is "apartment number".

In my country it should be the opposite, or all in one field.

I have tried changing this with code snippets I found online. They change the placeholder but only for a split second while the page is loading. After that they change back to the default values

add_filter( 'woocommerce_checkout_fields' 'override_billing_checkout_fields', 10, 1 );

   function override_billing_checkout_fields( $fields ) {
       $fields['billing']['billing_address_1']['placeholder'] = 'Address line 1';
       $fields['billing']['billing_address_2']['placeholder'] = 'Address line 2';

       $fields['Shipping']['shipping_address_1']['placeholder'] = 'Address line 1';
       $fields['Shipping']['shipping_address_2']['placeholder'] = 'Address line 2'; 
       return $fields;
       }


   add_filter( 'woocommerce_default_address_fields', 'uwc_new_address_one_placeholder', 1 );

   function uwc_new_address_one_placeholder( $fields ) {
       $address_fields['address_1']['placeholder'] = 'Address line 1';
       $address_fields['address_2']['placeholder'] = 'Address line 2';
       return $address_fields;
       }   

Tags : custom-field


Related Questions


Updated November 13, 2017 08:08 AM

Updated February 16, 2018 13:08 PM

Updated April 10, 2016 09:03 AM

Updated August 15, 2016 08:03 AM