Title: Undefined array keys
Last modified: November 1, 2023

---

# Undefined array keys

 *  Resolved [Chris](https://wordpress.org/support/users/eaonflux/)
 * (@eaonflux)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/undefined-array-keys-3/)
 * Ik krijg best wel vaak in de foutmeldingen in mijn dev console.
 * “Undefined array key “billing_birthdate”” en nog hoop andere. Nu ben ik zelf 
   even in jullie code gaan kijken aangezien ik dit snel opgelost moet hebben ivm
   dat ik bezig ben met het schrijven van een plugin.
 * Het gaat nu om jullie “wp-content/plugins/mollie-payments-for-woocommerce/src/
   Gateway/GatewayModule.php”
 * IN de method addPaymentMethodMandatoryFields checken julli niet altijd als een
   array element bestaat.
 * Dit is mijn aangepaste versie
 *     ```wp-block-code
       public function addPaymentMethodMandatoryFields($fields, string $gatewayName, string $field, $errors, string $paymentMethodName)
           {
               if (!isset($fields['payment_method']) || $fields['payment_method'] !== $gatewayName) {
                   return $fields;
               }
   
               $fieldExists = isset($fields[$field]);
               $fieldEmpty = $fieldExists ? $fields[$field] === '' : true;
   
               if (!$fieldExists || $fieldEmpty) {
                   $fieldPosted = filter_input(INPUT_POST, $field, FILTER_SANITIZE_SPECIAL_CHARS) ?? false;
   
                   if ($fieldPosted) {
                       $fields[$field] = $fieldPosted;
                   } else {
                       $errors->add(
                           'validation',
                           sprintf(
                               __(
                                   'Error processing %1$s payment, the %2$s field is required.',
                                   'mollie-payments-for-woocommerce'
                               ),
                               $paymentMethodName,
                               $field
                           )
                       );
                   }
               }
   
               if ($fieldEmpty) {
                   $errors->add(
                       'validation',
                       sprintf(
                           __(
                               'Please enter your %1$s, this is required for %2$s payments',
                               'mollie-payments-for-woocommerce'
                           ),
                           $field,
                           $paymentMethodName
                       )
                   );
               }
   
               return $fields;
           }
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Support [Femi](https://wordpress.org/support/users/femiyb/)
 * (@femiyb)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/undefined-array-keys-3/#post-17336115)
 * Hello
 * Apologies for getting back to you just now! While the community support forum
   hasn’t been actively maintained recently, you can always count on direct assistance
   from the [dedicated Mollie support team](https://wordpress.org/support/topic/guide-to-the-woocommerce-mollie-support-forum/)
   to address any questions or suggestions about the Mollie Payments for WooCommerce
   plugin.
 * That being said, thank you for pointing this out. Your feedback regarding the
   undefined array keys issue in the Mollie Payments for WooCommerce plugin has 
   been noted. Our development team will look into this to address and resolve the
   problem. Your contribution is greatly appreciated.
 * Regards,
   Femi.

Viewing 1 replies (of 1 total)

The topic ‘Undefined array keys’ is closed to new replies.

 * ![](https://ps.w.org/mollie-payments-for-woocommerce/assets/icon-256x256.png?
   rev=3090580)
 * [Mollie Payments for WooCommerce](https://wordpress.org/plugins/mollie-payments-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mollie-payments-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mollie-payments-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/mollie-payments-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mollie-payments-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mollie-payments-for-woocommerce/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Femi](https://wordpress.org/support/users/femiyb/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/undefined-array-keys-3/#post-17336115)
 * Status: resolved