Replace truthy check with isset when setting default checkout field value (#48031)

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
This commit is contained in:
Joey Kudish 2024-06-06 01:55:34 -07:00 committed by GitHub
parent d2046b1573
commit 506dac269e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix a bug with the woocommerce_get_default_value_for_{key} filter that was preventing setting a falsey value on a checkbox (i.e. to uncheck it dynamically)

View File

@ -1187,7 +1187,7 @@ class CheckoutFields {
*/
$value = apply_filters( "woocommerce_get_default_value_for_{$missing_field}", null, $group, $wc_object );
if ( $value ) {
if ( isset( $value ) ) {
$meta_data[ $missing_field ] = $value;
}
}