Reopen – First name field mandatory

This topic contains 6 replies, has 4 voices, and was last updated by  Alex Rollin 3 years, 8 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #1253

    joecam
    Buyer
    Post count: 63

    Hi,

    I was busy with some other task and inactive here, so my previous topic has been closed:
    https://wpinvoicing.com/support/topic/first-name-field-mandatory/

    I have set the name fields as not mandatory in the invoicing plugin, but the First name is still required during the checkout at the billing details page. I guess it is a bug…
    I would like to disable it so the user should check out without giving last/first name. Last name is OK, but the first name still needed for checkout.
    Thanks,

    I have the login details now, and will post it below.

    #1254

    joecam
    Buyer
    Post count: 63
    This reply has been marked as private.
    #1255

    Stiofan O’Connor
    Site Admin
    Post count: 22954

    I am pretty sure the first name is still required but i have flagged this for Patrik to check.

    Thanks,

    Stiofan

    #1256

    Patrik
    Moderator
    Post count: 1971

    Hi Joecam,

    The first name, address, city, state and country fields are required when the tax is enabled else it will work fine based on fields settings. So if you want to disable it then you can disable by putting the following code in your current theme’s functions.php file:

    
    
    add_filter('wpinv_checkout_required_fields', 'wpinv_checkout_required_fields_cb', 10, 1);
    function wpinv_checkout_required_fields_cb($required_fields){
        unset($required_fields['first_name']); //first name not required
        unset($required_fields['address']); //address not required
        unset($required_fields['city']); //city not required
        unset($required_fields['state']); //state not required
        unset($required_fields['country']); //country not required
        return $required_fields;
    }

    Please note: Some gateways may require this info when tax enabled. Also for tax calculation, it is required to have city, state, address or country fields.

    Let me know if any query.

    Regards,
    Patrik

    #1257

    joecam
    Buyer
    Post count: 63

    Hi Patrik and Stiofan,

    Thank you for your feedback and for the given solution, and I confirm that it works!

    Joe

    #1258

    Alex Rollin
    Moderator
    Post count: 27815

    Great!

    Thanks for letting us know!

    #1259

    Alex Rollin
    Moderator
    Post count: 27815
    This reply has been marked as private.
Viewing 7 posts - 1 through 7 (of 7 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket