Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #15718

    Dear Abundance,

    I’d like to change the ‘Postcode/Zip’ requirement in the Abundance checkout page to read ‘Phone Number’ instead.

    Could someone please tell me the coding I would look for and which template I would need to access– I believe I have to go to wp-content/plugins/woocommerce/classes/class-wc-checkout.php — as I was directed here before but I am just having trouble spotting the Postcode/Zip section.

    Much appreciated,

    Minnoe

    #88744

    I guess you can overwrite the label with following code – add it to the bottom of functions.php:

    // Hook in
    add_filter( 'woocommerce_checkout_fields' , 'inoplugs_override_checkout_fields' );

    // Our hooked in function - $fields is passed via the filter!
    function inoplugs_override_checkout_fields( $fields ) {
    $fields['billing']['billing_postcode']['label'] = 'Phone Number';
    $fields['shipping']['shipping_postcode']['label'] = 'Phone Number';
    return $fields;
    }

    #88745

    I would rather just change the template directly- the last time you were able to direct me to the original template so that where it said ‘special order notes’ I was instead able to write ‘delivery date’

    Is there any way you can direct me to the section of code where the ‘post code/zip’ label is so that I can just type ‘phone number’ instead. I am hesitant to add what you instructed above just because the last time I tried it I was met with a little bit of a disaster ie) my whole site disappeared . However going to the original source code which you were able to direct me to worked great.

    Thanks again

    Minnoe

    #88746

    Hi!

    Open up wp-content/plugins/woocommerce/classes/class-wc-countries.php and replace the label/placeholder text in following array:

    'postcode'	=> array(
    'label' => __('Postcode/Zip', 'woocommerce'),
    'placeholder' => __('Postcode/Zip', 'woocommerce'),
    'required' => true
    ),

    Regards,

    Peter

    #88747

    Hi Peter,

    Okay – that seemed to work okay. I am very close to getting everything just the way I want. Now I am hoping you can advise me if there’s a way under the tab Province (as I am based in Canada) if it can just automatically default to the choice of ‘Ontario’ under the drop down menu.

    Thanks!

    Minnoe

    #88748

    Hi!

    Afaik it’s currently not possible to set a standard value for dropdowns or radio boxes.

    Best regards,

    Peter

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Changing Postcode/Zip in Checkout Page’ is closed to new replies.