Home › Forums › WoodMart support forum › Inline Validation on checkout form
Inline Validation on checkout form
- This topic has 5 replies, 2 voices, and was last updated 9 months ago by Aizaz Imtiaz Awan.
-
AuthorPosts
-
February 22, 2024 at 1:23 am #542552
ijaskaur92ParticipantHow I can apply Inline validations on checkout page?
I need to delete last name, I want only first name.February 22, 2024 at 4:27 pm #542877
Aizaz Imtiaz AwanKeymasterHello,
You can configure the checkout fields in Dashboard -> WooCommerce -> Checkout Fields.
https://xtemos.com/docs-topic/fields-manager/Best Regards.
February 22, 2024 at 8:47 pm #542979
ijaskaur92ParticipantHow about inline validation, I want not to display validation all together at the top but want to display validation messages on each field.
February 23, 2024 at 2:09 pm #543179
Aizaz Imtiaz AwanKeymasterHello,
Please add the below code to the functions.php file into the Child theme.
add_filter( 'woocommerce_form_field', 'pk_checkout_fields_in_label_error', 10, 4 ); function pk_checkout_fields_in_label_error( $field, $key, $args, $value ) { if ( strpos( $field, '</label>' ) !== false && $args['required'] ) { $error = '<span class="error" style="display:none">'; $error .= sprintf( __( '%s is a required field.', 'woocommerce' ), $args['label'] ); $error .= '</span>'; $field = substr_replace( $field, $error, strpos( $field, '</label>' ), 0); } return $field; }
Then, add the following Custom CSS code to Theme Settings > Custom CSS > Global Custom CSS:
.woocommerce-checkout p.woocommerce-invalid-required-field span.error { color: #e2401c; display: block !important; font-weight: bold; }
Best Regards.
February 23, 2024 at 7:40 pm #543285
ijaskaur92ParticipantThank you for sharing code. Required field are working fine. But it still showing in blocks as well, How to remove this?
For postal code invalid, this message is not showing inline, but showing in block. Please advise.
I just want to show only below 2 messages in blocks as per attached screenshot.Attachments:
You must be logged in to view attached files.February 24, 2024 at 7:14 pm #543516
Aizaz Imtiaz AwanKeymasterHello,
Sorry to say there are no options in theme settings to achieve this. Such modification requires complicated code customization which is not covered by our support.
You need to find a third party plugin to achieve more functionality that best suits you.
https://wordpress.org/plugins/linear-checkout-for-woo-by-cartimize/Best Regards.
-
AuthorPosts
Tagged: Checkout page
- You must be logged in to create new topics. Login / Register