Skip to content

Commit 71efac7

Browse files
authored
Fix undefined type key warning (#4487)
* Address undefined type key warning * Add changelog entries * Fallback to blank type * Update changelog entries * Fix changelog entry * Follow the standard option defaults https://developer.woocommerce.com/docs/block-development/cart-and-checkout-blocks/additional-checkout-fields/#general-options * Update changelogs
1 parent 24998ac commit 71efac7

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* Fix - No such customer error when creating a payment method with a new Stripe account
1919
* Fix - Validate create customer payload against required billing fields before sending to Stripe
2020
* Update - Enhanced logging system with support for all log levels and improved context handling
21+
* Fix - Set default values for custom field options
2122

2223
= 9.6.0 - 2025-07-07 =
2324
* Fix - Register Express Checkout script before use to restore buttons on “order-pay” pages

includes/payment-methods/class-wc-stripe-express-checkout-custom-fields.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ public function get_custom_checkout_fields( $context = '' ) {
198198
foreach ( $additional_fields as $field_key => $field ) {
199199
$block_custom_checkout_fields[ $field_key ] = [
200200
'label' => $field['label'],
201-
'type' => $field['type'],
201+
'type' => $field['type'] ?? 'text',
202202
'location' => $checkout_fields->get_field_location( $field_key ),
203-
'required' => $field['required'],
203+
'required' => $field['required'] ?? false,
204204
];
205205
}
206206

@@ -223,9 +223,9 @@ public function get_custom_checkout_fields( $context = '' ) {
223223

224224
$classic_custom_checkout_fields[ $field_key ] = [
225225
'label' => $field['label'],
226-
'type' => $field['type'],
226+
'type' => $field['type'] ?? 'text',
227227
'location' => $fieldset,
228-
'required' => $field['required'],
228+
'required' => $field['required'] ?? false,
229229
];
230230
}
231231
}

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,6 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
128128
* Fix - No such customer error when creating a payment method with a new Stripe account
129129
* Fix - Validate create customer payload against required billing fields before sending to Stripe
130130
* Update - Enhanced logging system with support for all log levels and improved context handling
131+
* Fix - Set default values for custom field options
131132

132133
[See changelog for full details across versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).

0 commit comments

Comments
 (0)