• Resolved nemovich

    (@nemovich)


    Hello,

    Is there a plan to add conditional logic to registration form ? I want to show some fields based on chosen country and store them in the user profile.

    Do you know of any compatible plugin that can add this feature to b2b registration form ?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WebWizards

    (@webwizardsdev)

    Hi there,

    We can consider adding conditional logic in future updates, but there are no plans for this right now.

    My suggestion would be to use dedicated Forms plugins like WP Forms or Gravity Forms, etc, which already have conditional logic features.

    You can connect such a plugin to B2BKing (and make it able to register B2B users), by setting USER META. You need to set 2 user meta keys in the form:

    b2bking_b2buser must have the value yes
    b2bking_customergroup must have the value of a group ID. To get a group ID, go to B2BKing -> Groups -> Business Groups and click on a group. The number in the URL (E.g. ?post=123) is the ID.

    For example, here’s how to do that with WP Forms: https://wpforms.com/docs/how-to-set-up-custom-user-meta-fields/

    • This reply was modified 2 years, 6 months ago by WebWizards.
    • This reply was modified 2 years, 6 months ago by WebWizards.
    Thread Starter nemovich

    (@nemovich)

    Thank you for your reply.

    Yes I know that I can do that with other form plugins but none of them offers VAT validation which is a deal breaker for me. I searched for hours but I couldn’t find one with VIES validation. So I’m kinda stuck right now ??

    Plugin Author WebWizards

    (@webwizardsdev)

    I think custom coding would be the only way unfortunately.

    I can send you the code we use for VIES Validation if it helps.

    This is basically it:

    $client = new SoapClient("https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
    
    $country_code = substr($vat_number_inputted, 0, 2); // take first 2 chars
    $vat_number = substr($vat_number_inputted, 2); // remove first 2 chars
    
    $validation = $client->checkVat(array(
      'countryCode' => $country_code,
      'vatNumber' => $vat_number
    ));

    Maybe you can find a way to run it as part of WP Forms or a different forms plugin.

    Thread Starter nemovich

    (@nemovich)

    Thank you, that’s very helpful. I will try to find a way to implement it and report back if successful.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Form conditional logic’ is closed to new replies.