Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('woocommerce_checkout_process', 'quantity_checkout_field_process');
- function quantity_checkout_field_process() {
- // Check if set, if its not set add an error.
- //Check for product quantities
- $quantity_of_products_in_cart = product_quantities_in_cart();
- if($quantity_of_products_in_cart != 0) {
- $i = 0;
- while ($i < $quantity_of_products_in_cart) {
- $j = $i + 1;
- $attendee_name = 'attendee_name'. $j;
- $attendee_last_name = 'attendee_last_name'. $j;
- $attendee_phone = 'attendee_phone'. $j;
- $attendee_email = 'attendee_email'. $j;
- if ( ! $_POST[$attendee_name] )
- wc_add_notice( __( 'Please check on filling the First Name for attendee '. $j .'.' ), 'error' );
- if ( ! $_POST[$attendee_last_name] )
- wc_add_notice( __( 'Please check on filling the Last Name for attendee '. $j .'.' ), 'error' );
- if ( ! $_POST[$attendee_phone] )
- wc_add_notice( __( 'Please check on filling the Phone for attendee '. $j .'.' ), 'error' );
- if ( ! $_POST[$attendee_email] )
- wc_add_notice( __( 'Please check on filling the Email for attendee '. $j .'.' ), 'error' );
- $i++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement