Comments 1Mectronik started the conversationOctober 15, 2020 at 2:29pmHello , We to add one more code for ITALIAN customer only . It's a code requested for electronic invoices ( from begin of 2020 ) .It should be menaged like the VAT for EU . But We should it on registration for , only if country is ITALY .We added it on "Registration Field" but this appear ever , and We don't find the way to do what explained above . 2,218WebWizards repliedOctober 16, 2020 at 2:57pmHi Marco,The plugin doesn't have this functionality by default. VAT is a special field, there's no way to create other fields like it.But if you want, I can give you some JS code to add to functions.php that would set this up.This field should be REQUIRED and VISIBLE for ITALY and INVISIBLE for all other countries, correct?If you can give me a link to your registration page with this field, it would be even better, I could test directly in the site.1 Like 1Mectronik repliedOctober 21, 2020 at 4:36pmHi Stefan , if You can send JS code , this is very appreciated .Thanks 2,218WebWizards repliedOctober 23, 2020 at 12:26amThis code should work if you replace fieldInput and fieldContainer with the html input and its container in the form: var fieldContainer = jQuery('input[name="b2bking_custom_field_263"]').parent().parent(); var fieldInput = jQuery('input[name="b2bking_custom_field_263"]'); showHideRegistrationFieldsItaly(); jQuery('.b2bking_country_field_selector select').change(showHideRegistrationFieldsItaly); jQuery('select#billing_country').change(showHideRegistrationFieldsItaly); jQuery('select#b2bking_registration_roles_dropdown').change(showHideRegistrationFieldsItaly); function showHideRegistrationFieldsItaly(){ let selectedRole = jQuery('#b2bking_registration_roles_dropdown').val(); let roleDisplay = jQuery('#b2bking_registration_roles_dropdown').css('display'); let hiddenRole = false; if (roleDisplay !== 'inline-block' && roleDisplay !== 'block'){ hiddenRole = true; } if (hiddenRole === true || fieldContainer.hasClass('b2bking_custom_registration_'+selectedRole) || fieldContainer.hasClass('b2bking_custom_registration_allroles')){ let selectedCountry = jQuery('.b2bking_country_field_selector select').val(); if (selectedCountry === undefined){ selectedCountry = jQuery('select#billing_country').val(); } if (selectedCountry === 'IT'){ // required and visible fieldInput.prop('required', true); fieldContainer.css('display', 'block'); } else { // not required and hidden fieldInput.removeAttr('required'); fieldContainer.css('display', 'none'); } } else { // not required and hidden fieldInput.removeAttr('required'); fieldContainer.css('display', 'none'); } } Or if you can share a link to you registration page and which field it is, I can make the code more precise to your site. Sign in to reply ...
Hello , We to add one more code for ITALIAN customer only . It's a code requested for electronic invoices ( from begin of 2020 ) .
It should be menaged like the VAT for EU . But We should it on registration for , only if country is ITALY .
We added it on "Registration Field" but this appear ever , and We don't find the way to do what explained above .
Hi Marco,
The plugin doesn't have this functionality by default. VAT is a special field, there's no way to create other fields like it.
But if you want, I can give you some JS code to add to functions.php that would set this up.
This field should be REQUIRED and VISIBLE for ITALY and INVISIBLE for all other countries, correct?
If you can give me a link to your registration page with this field, it would be even better, I could test directly in the site.
Hi Stefan , if You can send JS code , this is very appreciated .
Thanks
This code should work if you replace fieldInput and fieldContainer with the html input and its container in the form:
Or if you can share a link to you registration page and which field it is, I can make the code more precise to your site.