• Resolved stivenson2005

    (@stivenson2005)


    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 - {&quot;id&quot;:null,&quot;type&quot;:&quot;POST&quot;,&quot;title&quot;:&quot;Create order&quot;,&quot;request_url&quot;:&quot;https://test.api.dibspayment.eu/v1/payments&quot;,&quot;request&quot;:{&quot;headers&quot;:{&quot;Content-type&quot;:&quot;application/json&quot;,&quot;Accept&quot;:&quot;application/json&quot;,&quot;Authorization&quot;:&quot;test-secret-key-7fc9378721a74b9191ccf5f8b728cdbd&quot;,&quot;commercePlatformTag&quot;:&quot;WooEasyKrokedil&quot;},&quot;user-agent&quot;:&quot;WordPress/6.0.2; www.badminton-norge.no - Plugin/2.1.0 - PHP/8.1.10 - Krokedil&quot;,&quot;method&quot;:&quot;POST&quot;,&quot;timeout&quot;:10,&quot;body&quot;:{&quot;order&quot;:{&quot;items&quot;:[{&quot;reference&quot;:&quot;406&quot;,&quot;name&quot;:&quot;Badminton Lodd - 2022&quot;,&quot;quantity&quot;:1,&quot;unit&quot;:&quot;pcs&quot;,&quot;unitPrice&quot;:2000,&quot;taxRate&quot;:0,&quot;taxAmount&quot;:0,&quot;grossTotalAmount&quot;:2000,&quot;netTotalAmount&quot;:2000},{&quot;reference&quot;:&quot;609&quot;,&quot;name&quot;:&quot;test product&quot;,&quot;quantity&quot;:1,&quot;unit&quot;:&quot;pcs&quot;,&quot;unitPrice&quot;:2000,&quot;taxRate&quot;:0,&quot;taxAmount&quot;:0,&quot;grossTotalAmount&quot;:2000,&quot;netTotalAmount&quot;:2000}],&quot;amount&quot;:4000,&quot;currency&quot;:&quot;NOK&quot;,&quot;reference&quot;:&quot;611&quot;},&quot;checkout&quot;:{&quot;termsUrl&quot;:&quot;https://www.badminton-norge.no/personvernerklaering/&quot;,&quot;returnUrl&quot;:&quot;https://www.badminton-norge.no/checkout/order-received/611/?key=wc_order_kopQ09RzWgTjz&easy_confirm=yes&quot;,&quot;integrationType&quot;:&quot;HostedPaymentPage&quot;,&quot;merchantHandlesConsumerData&quot;:true,&quot;shipping&quot;:{&quot;countries&quot;:[],&quot;merchantHandlesShippingCost&quot;:false},&quot;consumer&quot;:{&quot;email&quot;:&quot;[email protected]&quot;,&quot;shippingAddress&quot;:{&quot;addressLine2&quot;:&quot;Badomenton Club Arendal&quot;,&quot;country&quot;:&quot;NOR&quot;},&quot;phoneNumber&quot;:{&quot;prefix&quot;:&quot;+47&quot;,&quot;number&quot;:&quot;46919157&quot;},&quot;privatePerson&quot;:{&quot;firstName&quot;:&quot;Navn&quot;,&quot;lastName&quot;:&quot;Navensen&quot;}},&quot;consumerType&quot;:{&quot;supportedTypes&quot;:[&quot;B2C&quot;,&quot;B2B&quot;],&quot;default&quot;:&quot;B2C&quot;}},&quot;notifications&quot;:{&quot;webHooks&quot;:[{&quot;eventName&quot;:&quot;payment.checkout.completed&quot;,&quot;url&quot;:&quot;https://www.badminton-norge.no/wc-api/DIBS_Api_Callbacks/?dibs-payment-created-callback=1&quot;,&quot;authorization&quot;:&quot;c046ea7267&quot;}]},&quot;merchantNumber&quot;:&quot;100048700&quot;}},&quot;response&quot;:{&quot;body&quot;:&quot;{\&quot;errors\&quot;:{\&quot;checkout.Consumer.ShippingAddress.AddressLine1\&quot;:[\&quot;'Address Line1' must not be empty.\&quot;],\&quot;checkout.Consumer.ShippingAddress.City\&quot;:[\&quot;'City' must not be empty.\&quot;],\&quot;checkout.Consumer.ShippingAddress.PostalCode\&quot;:[\&quot;'Postal Code' must not be empty.\&quot;]}}&quot;,&quot;code&quot;:400},&quot;timestamp&quot;:&quot;2022-10-08 18:00:27&quot;,&quot;stack&quot;:[&quot;get_stack&quot;,&quot;format_log&quot;,&quot;log_response&quot;,&quot;process_response&quot;,&quot;request&quot;,&quot;create_nets_easy_order&quot;,&quot;process_payment&quot;,&quot;process_order_payment&quot;,&quot;process_checkout&quot;,&quot;checkout&quot;,&quot;apply_filtersWC_AJAX::checkout : 10&quot;,&quot;do_actionWC_AJAX::checkout : 10&quot;,&quot;do_action&quot;,&quot;do_wc_ajax&quot;,&quot;apply_filters0000000000003f0b0000000000000000init_render_mode : 0&quot;,&quot;do_action0000000000003f0b0000000000000000init_render_mode : 0&quot;,&quot;do_action&quot;,&quot;require_once&quot;,&quot;require&quot;],&quot;plugin_version&quot;:&quot;2.1.0&quot;}</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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter stivenson2005

    (@stivenson2005)

    You can ignore this, as I have resolved this by looking for a different approach.

    As i modified the Address_2 to use it as a filed for something else on the website and seems even if the address is unset as long as one of the address fields is populated, so the rest becomes mandatory regardless.

    Resolved this by hiding all including address_2 and made my own custom checkout field and this seem to resolved my “issue”.

    Thank you anyways and have a great week!

    Thanks for reporting back! Glad it worked out.

    /Andreas

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Address line 1 must not be empty’ is closed to new replies.