• Resolved anniehilator

    (@anniehilator)


    I have an issue in deleting the zip code field as my country do not deal with them, yet it can’t be deleted, it is locked when i try to edit it from theme editor, when i use php code lines, nothing changes.

    i use underscores custom theme

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    In order to troubleshoot this further, please do the following:

    • Share which country should not be using Zip codes; As far as I’m aware, WooCommerce already takes care of showing/hiding ZIP code on a per-country basis
    • Share screenshots of the exact areas where you’ve already tried removing the ZIP code fields
    • Share the PHP code that you’ve already tried

    Thanks!

    Thread Starter anniehilator

    (@anniehilator)

    Hello,

    the country is Algeria, it indeed has zip code areas but they aren’t really used among people in general, as where i tried to hide the zip codes:

    1 – from the theme editor (the checkout zip code fields were locked, as shown in the attached image) i could edit some fields there, but not the address one

    https://www.dropbox.com/scl/fi/zyrrwl3p0hrvdvemfdrb9/Screen-Shot-2024-09-22-at-9.04.06-PM.png?rlkey=89m0s0noewixipbehu2f4ehzl&st=2ez6a7f7&dl=0

    (the img block is smh not working so i attach properly)

    2- the php code lines added in functions.php :

    // Disable zip/postcode field add_filter( ‘woocommerce_checkout_fields’ , ‘QuadLayers_remove_billing_postcode_checkout’ ); function QuadLayers_remove_billing_postcode_checkout( $fields ) { unset($fields[‘billing’][‘billing_postcode’]); return $fields; }

    and also this:

    add_filter( ‘woocommerce_blocks_checkout_update_order_meta’, function( $fields ) {
    unset( $fields[‘billing_postcode’] ); // Remove billing postcode
    unset( $fields[‘shipping_postcode’] ); // Remove shipping postcode
    return $fields;
    }, 9999 );

    i’m developing the website locally, i don’t know if this info has any relevance

    thank you !

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @anniehilator

    When you use Checkout Block, editing or removing any field using PHP code or a plugin doesn’t work. So, if you need to make these changes, switch to a classic checkout block or shortcode.

    I hope this helps! Please let us know how it goes or if you need further assistance.

    Thread Starter anniehilator

    (@anniehilator)

    Thank you so much, it worked

    Plugin Support Rajesh K. (woo-hc)

    (@rajeshml)

    Hello @anniehilator,

    Glad to know that we were able to help.

    Should you have further inquiries, kindly create a new topic here.

    Meanwhile, if it isn’t too much to ask for – would you mind leaving us a review here? It only takes a couple of minutes but helps us tremendously. It would mean so much to us and would go a long way.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.