Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Validate Custom Field
- *
- * @description check for errors without custom fields
- *
- * @param $valid_data
- * @param $data
- */
- function give_myprefix_validate_custom_fields( $valid_data, $data ) {
- //Check that we're validating the proper form
- //Remove if this is a global field
- if ( $data['give-form-id'] !== '4855' ) {
- return;
- }
- //Check for a referral data
- if ( empty( $data['give_items'] ) ) {
- give_set_error( 'give_items', __( 'Per cortesia indica il numero di panettoni per i quali stai facendo la donazione.', 'give' ) );
- }
- if ($data[give-amount] > ($data['give_items']*10)){
- give_set_error( 'give_amount', __( 'Ricorda che la donazione massima per un singolo panettone รจ di 10 euro.', 'give' ) );
- }
- }
- add_action( 'give_checkout_error_checks', 'give_myprefix_validate_custom_fields', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement