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
- https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ https://stackoverflow.com/questions/46326620/custom-placeholder-for-all-woocommerce-checkout-fields
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;
}