Address line 1 must not be empty
-
Hi, and thank you for the continues good work and appreciate it.
I have an issue where I am making a website for a client, and they wont be selling anything physical so no shipping address nor postal code required. I have used filters to remove these fields from the checkout page. But when attempting to use NetsEASY to complete a payment using the redirect method, so I get an error.
When pressing on Complete Payment, it spits an error saying “Internal server error” when clicking on the Complete payment again, it reveals the error and it indicates
” ‘Address Line1’ must not be empty. ‘City’ must not be empty. ‘Postal Code’ must not be empty. ”
Any insight or help with this is highly appreciated.
Here is the debug log when this happens.
<code>10-08-2022 @ 20:00:27 - {"id":null,"type":"POST","title":"Create order","request_url":"https://test.api.dibspayment.eu/v1/payments","request":{"headers":{"Content-type":"application/json","Accept":"application/json","Authorization":"test-secret-key-7fc9378721a74b9191ccf5f8b728cdbd","commercePlatformTag":"WooEasyKrokedil"},"user-agent":"WordPress/6.0.2; www.badminton-norge.no - Plugin/2.1.0 - PHP/8.1.10 - Krokedil","method":"POST","timeout":10,"body":{"order":{"items":[{"reference":"406","name":"Badminton Lodd - 2022","quantity":1,"unit":"pcs","unitPrice":2000,"taxRate":0,"taxAmount":0,"grossTotalAmount":2000,"netTotalAmount":2000},{"reference":"609","name":"test product","quantity":1,"unit":"pcs","unitPrice":2000,"taxRate":0,"taxAmount":0,"grossTotalAmount":2000,"netTotalAmount":2000}],"amount":4000,"currency":"NOK","reference":"611"},"checkout":{"termsUrl":"https://www.badminton-norge.no/personvernerklaering/","returnUrl":"https://www.badminton-norge.no/checkout/order-received/611/?key=wc_order_kopQ09RzWgTjz&easy_confirm=yes","integrationType":"HostedPaymentPage","merchantHandlesConsumerData":true,"shipping":{"countries":[],"merchantHandlesShippingCost":false},"consumer":{"email":"[email protected]","shippingAddress":{"addressLine2":"Badomenton Club Arendal","country":"NOR"},"phoneNumber":{"prefix":"+47","number":"46919157"},"privatePerson":{"firstName":"Navn","lastName":"Navensen"}},"consumerType":{"supportedTypes":["B2C","B2B"],"default":"B2C"}},"notifications":{"webHooks":[{"eventName":"payment.checkout.completed","url":"https://www.badminton-norge.no/wc-api/DIBS_Api_Callbacks/?dibs-payment-created-callback=1","authorization":"c046ea7267"}]},"merchantNumber":"100048700"}},"response":{"body":"{\"errors\":{\"checkout.Consumer.ShippingAddress.AddressLine1\":[\"'Address Line1' must not be empty.\"],\"checkout.Consumer.ShippingAddress.City\":[\"'City' must not be empty.\"],\"checkout.Consumer.ShippingAddress.PostalCode\":[\"'Postal Code' must not be empty.\"]}}","code":400},"timestamp":"2022-10-08 18:00:27","stack":["get_stack","format_log","log_response","process_response","request","create_nets_easy_order","process_payment","process_order_payment","process_checkout","checkout","apply_filtersWC_AJAX::checkout : 10","do_actionWC_AJAX::checkout : 10","do_action","do_wc_ajax","apply_filters0000000000003f0b0000000000000000init_render_mode : 0","do_action0000000000003f0b0000000000000000init_render_mode : 0","do_action","require_once","require"],"plugin_version":"2.1.0"}</code>
The code used to remove the checkout fields that isnt needed for this shop.
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); add_filter( 'woocommerce_billing_fields' , 'custom_override_billing_fields' ); function custom_override_checkout_fields( $fields ) { unset($fields['billing']['billing_address_1']); ($fields['billing']['billing_address_2']); //used to select club as dropdown unset($fields['billing']['billing_city'] ); unset($fields['billing']['billing_company']); unset($fields['order']['order_comments']); unset( $fields['billing_postcode']); return $fields; } function custom_override_billing_fields( $fields ) { unset($fields['billing_address_1'] ); unset($fields['billing']['billing_address_2']); unset($fields['billing']['billing_city']); unset($fields['billing']['billing_company']); unset($fields['order']['order_comments'] ); unset( $fields['billing_postcode']); return $fields; }
Theme used: Astra
Thank you again for the good work you do.
Kind regards,
Mark
- The topic ‘Address line 1 must not be empty’ is closed to new replies.