• Resolved sahanpasindu

    (@sahanpasindu)


    Hello,

    I would like to know is there any way to add text before or after the zip code input (zip code entering text box) on the Checkout page? I want to link a page that contains a list of zip codes in case the user has no idea about his/her place zipcode.

    Please share any info with me.
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    Hey there,

    The easiest option would be to add that postal code list to the checkout page by editing the page. Here’s an example of how to do that:
    https://writenowdesign.com/blog/wordpress/woocommerce/add-message-top-bottom-woocommerce-checkout-page/

    Otherwise, you’ll need to modify the page template using hooks and filters. Here’s a good place to get started:
    https://hollerwp.com/customize-woocommerce-checkout-page/

    Thread Starter sahanpasindu

    (@sahanpasindu)

    Thank you. I just made a dropdown option in which the user can select their zip code, In my case, I give the zip code as the identifier and the City name as the select option. So people will no need to know about zip codes.

    add_filter( ‘woocommerce_default_address_fields’ , ‘customize_postcode_fields’ );
    function customize_postcode_fields( $adresses_fields ) {

    $adresses_fields[‘postcode’][‘type’] = ‘select’;
    $adresses_fields[‘postcode’][‘options’] = array(
    ” => __(‘Select your postcode’, ‘woocommerce’),
    ‘11536’ => ‘Akaragama’,
    ‘10732’ => ‘Akarawita’,
    );

    return $adresses_fields;
    }

    But to work that you should have to add these zip codes in your shipping zone. This will change shipping cost according to the city name (or whatever you gave)

    Thank you again for your suggestion that the suggestion was easy!

    Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    I’m glad you solved it. That looks downright elegant, so thank you for sharing!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add text after or before postcode code input in woocommerce checkout page’ is closed to new replies.