Last active
January 11, 2022 09:19
-
-
Save cartimize/0f69167718575776449f6daabdf47d13 to your computer and use it in GitHub Desktop.
Shipping and Billing full name Javascript and php validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Shipping full name validation | |
jQuery( document.body ).on( 'cartimize_shipping_full_name_validation', function(event, defaultResult, fieldValue){ | |
//Add your custom code here. Return true or false else it will use default validation | |
//Example: Check fieldValue empty or not | |
if(fieldValue.length === 0 ){ | |
return false; | |
}else{ | |
return true; | |
} | |
}); | |
// Billing full name validation | |
jQuery( document.body ).on( 'cartimize_billing_full_name_validation', function(event, defaultResult, fieldValue){ | |
//Add your custom code here. Return true or false else it will use default validation | |
//Example: Check fieldValue empty or not | |
if(fieldValue.length === 0 ){ | |
return false; | |
}else{ | |
return true; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('cartimize_front_end_parsley_errors', 'cartimize_custom_cartimize_front_end_parsley_errors', 10, 1); | |
function cartimize_custom_cartimize_front_end_parsley_errors( $value ){ | |
$value['parsley_errors']['shipping_fullname']= esc_html( 'This value is required.'); | |
$value['parsley_errors']['billing_fullname']= esc_html( 'This value is required.'); | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment