before-checkout-form.php
43 lines
| 1 | <style> |
| 2 | <?php if ( isset( $args['settings']['billing'] ) && is_array( $args['settings']['billing'] ) ) : ?> |
| 3 | <?php foreach ( $args['settings']['billing'] as $field ) : ?> |
| 4 | <?php if ( ( $field['required'] ?? '' ) == '0' && ( $field['custom_field'] ?? '' ) != '1' ) : ?> |
| 5 | #<?php echo esc_attr( $field['name'] ); ?>_field abbr { |
| 6 | display: none !important; |
| 7 | } |
| 8 | <?php endif; ?> |
| 9 | <?php endforeach; ?> |
| 10 | <?php endif; ?> |
| 11 | |
| 12 | <?php if ( isset( $args['settings']['shipping'] ) && is_array( $args['settings']['shipping'] ) ) : ?> |
| 13 | <?php foreach ( $args['settings']['shipping'] as $field ) : ?> |
| 14 | <?php if ( ( $field['required'] ?? '' ) == '0' && ( $field['custom_field'] ?? '' ) != '1' ) : ?> |
| 15 | #<?php echo esc_attr( $field['name'] ); ?>_field abbr { |
| 16 | display: none !important; |
| 17 | } |
| 18 | <?php endif; ?> |
| 19 | <?php endforeach; ?> |
| 20 | <?php endif; ?> |
| 21 | </style> |
| 22 | |
| 23 | <script type="text/javascript"> |
| 24 | window.addEventListener('load', function() { |
| 25 | <?php if ( isset( $args['settings']['billing'] ) && is_array( $args['settings']['billing'] ) ) : ?> |
| 26 | <?php foreach ( $args['settings']['billing'] as $field ) : ?> |
| 27 | <?php if ( ( $field['required'] ?? '' ) == '0' && ( $field['custom_field'] ?? '' ) != '1' ) : ?> |
| 28 | document.getElementById('<?php echo esc_attr( $field['name'] ); ?>_field')?.classList.remove('validate-required'); |
| 29 | <?php endif; ?> |
| 30 | <?php endforeach; ?> |
| 31 | <?php endif; ?> |
| 32 | <?php if ( isset( $args['settings']['shipping'] ) && is_array( $args['settings']['shipping'] ) ) : ?> |
| 33 | <?php foreach ( $args['settings']['shipping'] as $field ) : ?> |
| 34 | <?php if ( ( $field['required'] ?? '' ) == '0' && ( $field['custom_field'] ?? '' ) != '1' ) : ?> |
| 35 | document.getElementById('<?php echo esc_attr( $field['name'] ); ?>_field')?.classList.remove('validate-required'); |
| 36 | <?php endif; ?> |
| 37 | <?php endforeach; ?> |
| 38 | <?php endif; ?> |
| 39 | }); |
| 40 | var fcf_ajaxurl = '<?php echo admin_url( 'admin-ajax.php' ); ?>'; |
| 41 | var inspire_upload_nonce = '<?php echo wp_create_nonce( 'inspire_upload_nonce' ); ?>'; |
| 42 | </script> |
| 43 |