• Resolved kentnerd

    (@kentnerd)


    Hello everyone,

    I’ve read several threads that have talked about this, but they haven’t been helpful.

    I am using WooCommerce that is integrated with Elavon as the payment gateway (most of the threads I’ve seen, people have been using Paypal and other payment gateways).

    I have added the proper filters to unset the fields and the fields are successfully removed from my checkout page. However, when I attempt to pay for the item, I get an error that says:

    An error occurred, please try again or try an alternate form of payment.

    This is what I have added to my functions.php file:

    
    function custom_override_checkout_fields( $fields ) {
       if( woo_cart_has_virtual_product() == true ) {
            unset($fields['billing']['billing_first_name']);
            unset($fields['billing']['billing_last_name']);
            unset($fields['billing']['billing_company']);
            unset($fields['billing']['billing_address_1']);
            unset($fields['billing']['billing_address_2']);
            unset($fields['billing']['billing_city']);
            unset($fields['billing']['billing_postcode']);
            unset($fields['billing']['billing_country']);
            unset($fields['billing']['billing_state']);
            unset($fields['billing']['billing_phone']);
            unset($fields['order']['order_comments']);
            unset($fields['billing']['billing_address_2']);
            unset($fields['billing']['billing_postcode']);
            unset($fields['billing']['billing_company']);
            unset($fields['billing']['billing_last_name']);
            unset($fields['billing']['billing_email']);
            unset($fields['billing']['billing_city']);
            return $fields;
       }
    }
    

    A couple notes:
    1. My items are all virtual/downloadable items. I should mention that before I added the above code, my product was already created and I noticed that the product was not checked off as virtual/downloadable. Perhaps this plays a part?
    I don’t think it should.

    2. When the address fields are present, and I enter everything, I’m able to pay for the items without issue.

    3. I integrated WooCommerce Elavon with Pinpoint Booking System. In the wordpress backend, I thought that perhaps this error had to do with the “required” fields for my calendar’s payment settings. In those settings, I disabled all of them but still, I get the error

    Any thoughts on how I can fix this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    When the address fields are present, and I enter everything, I’m able to pay for the items without issue.

    This seems to indicate that Elavon has an absolute requirement for those billing fields to be present in order for the payment to be processed. As an example, PayPal Standard only requires the name & email address (these vary per gateway).

    Moving forward, have you checked with Elavon which billing fields is an absolute requirement in order for payments to be processed?

    Thread Starter kentnerd

    (@kentnerd)

    Hey RK,

    Thank you so much for the quick response.

    I actually didn’t get a chance to check with Elavon myself, but my partner contacted them and they did something to remove the requirement for the billing fields.

    I ran a test and my order went through. I did not receive the error, and the order appeared in the WooCommerce backend under “Orders”.

    So, I guess for future reference, in case others integrate Elavon with WooCommerce and are experiencing issues with this, just call Elavon.

    If I find out more info on specifically what Elavon (and my partner) did, I’ll make sure to come back and update you guys.

    I should probably also note that when my partner had Elavon remove the billing fields requirement, the following code remained in our functions.php file:

    
        add_filter('woocommerce_billing_fields', function($fields = array() ) {
          unset($fields['billing_company']);
          unset($fields['billing_address_1']);
          unset($fields['billing_address_2']);
          unset($fields['billing_city']);
          unset($fields['billing_state']);
          unset($fields['billing_country']);
          unset($fields['billing_postcode']);
          // unset($fields['billing_phone']);
          unset($fields['billing_email']);
          return $fields;
        });
    
        add_filter( 'woocommerce_get_country_locale', function($locale = array()) {
          $locale['US']['billing_address_1']['required'] = false;
          $locale['US']['billing_address_2']['required'] = false;
          $locale['US']['billing_city']['required'] = false;
          $locale['US']['billing_state']['required'] = false;
          $locale['US']['billing_country']['required'] = false;
          $locale['US']['billing_postcode']['required'] = false;
    
          return $locale;
        });
    

    I’m not sure if either filter made a difference (I doubt it).

    Thank you!

    Just FYI for other wordpress devs: I’ve called Elavon support before, and they were quite helpful, so don’t hesitate to reach out to them. (i think) they have 24/7 support at 1-800-725-1243. Good luck, and happy coding ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WooCommerce Requiring Address Fields’ is closed to new replies.