0

I am trying to change the checkout label and placeholder for the postcode field.

However using this code:

function custom_wc_checkout_fields( $fields ) {

$fields['billing']['billing_postcode']['placeholder'] = 'Postnummer';
$fields['billing']['billing_postcode']['label'] = 'Postnummer';

return $fields; }

Simply returns the the usual output which is "Postnummer/ZIP."

If I set it to false:
$fields['billing']['billing_postcode']['label'] = false; Then it doesn't show up. However, if I put the placeholder to false, it still shows up.

What can I do?

0

You need to hook in your function properly, so try this before your code (in functions.php):

// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_wc_checkout_fields' );
  • Wouldn't it be? : add_filter( 'woocommerce_checkout_fields' , 'custom_wc_checkout_fields' ); Because I have already got this in my code, just thought it was axiomatic, so left it out. – mikkeljuhl Oct 26 '15 at 11:43
  • Ah yes, good one (edited), well so long as you have that I would have thought you'd be ok. We do this with all our Woo installs. Perhaps try removing it altogether and adding it afresh as a new field. – Monkey Puzzle Oct 27 '15 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.