Untitled

 avatar
unknown
plain_text
2 years ago
830 B
6
Indexable
function add_business_checkbox_to_registration() {
    woocommerce_form_field(
        'is_business', 
        array(
            'type'        => 'checkbox',
            'label'       => __('I am a business'),
            'required'    => false,
        )
    );
}
add_action('woocommerce_register_form', 'add_business_checkbox_to_registration', 1);

add_action('wp_head', function(){
	?>
	<script>
		jQuery(document).ready(function($) {
			$('#is_business').change(function() {
				if ($(this).is(':checked')) {
					$('#b2bking_registration_roles_dropdown').val('role_179').change();
				} else {
					$('#b2bking_registration_roles_dropdown').val('role_178').change();
				}
			});
		});

	</script>
	<style type="text/css">
		.b2bking_registration_roles_dropdown_section{
			display:none !important;
		}
	</style>
	<?php
});
Editor is loading...
Leave a Comment