• Resolved webxelent

    (@webxelent)


    Hi everyone,

    I’m running into an issue with my WooCommerce checkout. I sell only digital goods, so I decided to simplify the checkout process by removing all unnecessary address fields and keeping only the Country field. I used the Checkout Field Editor for WooCommerce plugin to disable all fields except the country field.

    While the fields are successfully hidden and removed, the problem is that the Place Order button stops working. Clicking the button doesn’t process the order, and there are no error messages displayed. It seems like something is preventing the form from validating or submitting properly.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Elena

    (@elenathemehigh)

    Could you please check after adding the below code in your child theme’s functions.php file?

    add_filter('woocommerce_get_country_locale', function( $locale ) {
    foreach ( $locale as $key => $value ) {
    $locale[ $key ]['address_1'] = [
    'required' => false,
    'hidden' => true,
    ];

    $locale[ $key ]['postcode'] = [
    'required' => false,
    'hidden' => true,
    ];

    $locale[ $key ]['city'] = [
    'required' => false,
    'hidden' => true,
    ];

    $locale[ $key ]['state'] = [
    'required' => false,
    'hidden' => true,
    ];
    }

    return $locale;
    });

    add_filter( 'woocommerce_localisation_address_formats', function( $formats ) {
    foreach ( $formats as $key => $format ) {
    $formats[ $key ] = "{first_name} {last_name}\n{country}";
    // You can also use
    {name} instead of first name and last name.
    }

    return $formats;
    } );

    Kindly be informed that removing/disabling default WooCommerce fields like country and first_name will lead to unexpected behaviours on the checkout page and also may lead to unexpected errors on the site. We kindly ask that you avoid removing them from the checkout process.

    Thank you!

    Thread Starter webxelent

    (@webxelent)

    Thank you, that’s exactly what I was looking for.

    Plugin Support Elena

    (@elenathemehigh)

    Great!

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