Checkout fields validation doesn’t work.

This topic has 2 replies, 2 voices, and was last updated 1 years ago ago by Rose Tyler

  • Avatar: Mircea
    May 25, 2023 at 09:08

    I am trying to validate each of the checkout fields, but I still get the general error message “Please fill out all required fields.” I cleared the cache, so this is excluded.

    I added this code in the functions.php of the child theme:
    add_action(‘woocommerce_checkout_process’, ‘my_custom_checkout_field_process’);

    function my_custom_checkout_field_process() {
    // Check if set, if its not set add an error.
    if ( strlen($_POST[‘billing_first_name’])<2 )
    wc_add_notice( __( 'Please enter a full name first.' ), 'error' );
    But I guess that the general message has priority because it is a client side validation. Can you tell me in which file is this validation done so I can overwrite it? I also tried to translate this string but I was not able to find it in the translations files of woocommerce, xstore core, xstore theme.


    1 Answer
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 25, 2023 at 13:11

    Hello Mircea,

    Thank you for contacting us and for using XStore.

    Please try to test how it works with the default WooCommerce theme – Storefront activated on your site.

    We suppose this is independent of the theme and you need to contact WooCommerce support –

    We hope this information is helpful.

    Kind Regards,
    8theme team

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.