WooCommerce Requiring Address Fields
-
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?
- The topic ‘WooCommerce Requiring Address Fields’ is closed to new replies.