WordPress.org

Forums

WooCommerce - excelling eCommerce
Woocommerce address before payment (5 posts)

  1. onirisweb
    Member
    Posted 7 months ago #

    Hi,

    I am a newbie in Woocommerce. I am building an ecommerce site with this plugin.

    My problem is simple, but I can't find any option to display what I want.

    I would like that the customers following the payment gateway have to fill their data (address, phone, etc.) before paying.

    Actually that's not the case on my e-boutique. During the process, they can avoid to fill these information and pay, which is a big issue for me.

    Is there any option to precise in the admin for that, diplaying a warning message like "***please precise data before payment***" that prevent them to proceed to any payment ?

    Or may be a payment gateway with one step for one page, like we can find in many ecommerce site ? Is there any add-on for that ?

    You can check my site's demo and see the actual process : http://dogeverywhere.com/therapy-store/

    Thanks for your help :)

    https://wordpress.org/plugins/woocommerce/

  2. terrytsang
    Member
    Posted 7 months ago #

    Hi @onirisweb, you can make the checkout fields compulsory to fill in by putting below code into your theme functions.php:

    // Example code to make billing first name, all address fields, email and phone required
    add_filter( 'woocommerce_checkout_fields', 'custom_checkout_fields' );
    
    function custom_checkout_fields ( $fields ) {
      $fields['billing']['billing_first_name']['required'] = true;
      $fields['billing']['billing_address_1']['required'] = true;
      $fields['billing']['billing_city']['required'] = true;
      $fields['billing']['billing_postcode']['required'] = true;
      $fields['billing']['billing_country']['required'] = true;
      $fields['billing']['billing_state']['required'] = true;
      $fields['billing']['billing_email']['required'] = true;
      $fields['billing']['billing_phone']['required'] = true;
    
      return $fields;
    }

    Here is the full list of fields in the array passed to woocommerce_checkout_fields:

    billing
    - billing_first_name
    - billing_last_name
    - billing_company
    - billing_address_1
    - billing_address_2
    - billing_city
    - billing_postcode
    - billing_country
    - billing_state
    - billing_email
    - billing_phone
    shipping
    - shipping_first_name
    - shipping_last_name
    - shipping_company
    - shipping_address_1
    - shipping_address_2
    - shipping_city
    - shipping_postcode
    - shipping_country
    - shipping_state
    account
    - account_username
    - account_password
    - account_password-2
    order
    - order_comments

    You can refer this official documentation link for more example.

    Or you can purchase my custom checkout plugin if you need more options.

  3. onirisweb
    Member
    Posted 7 months ago #

    Hi terrytsang,

    Thanks for your reply. I'll try this function. I come back later...

  4. onirisweb
    Member
    Posted 7 months ago #

    Wonderful it works !
    I just wonder if it will stil work if I enable a Facebook login addon.

    I'll try and if there's any issue, I'll come back of course :)

  5. terrytsang
    Member
    Posted 7 months ago #

    Hi @onirisweb, my Facebook login addon will automatically saved first name, last name and email, so it should be working.

Reply

You must log in to post.

About this Plugin

About this Topic