Skip to content

Commit

Permalink
fix: check for existence of class constant before using
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoo committed Mar 1, 2024
1 parent 00cea1d commit 9c92297
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions includes/class-modal-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -1028,9 +1028,11 @@ public static function ensure_base_default_customer_address( $option_value ) {
}

// If billing state is required but billing country is not, we need to ensure a default location is set.
$billing_fields = get_option( Donations::DONATION_BILLING_FIELDS_OPTION, [] );
if ( ! in_array( 'billing_country', $billing_fields, true ) && in_array( 'billing_state', $billing_fields, true ) ) {
return 'base';
if ( defined( '\Newspack\Donations::DONATION_BILLING_FIELDS_OPTION' ) ) {
$billing_fields = get_option( \Newspack\Donations::DONATION_BILLING_FIELDS_OPTION, [] );
if ( ! in_array( 'billing_country', $billing_fields, true ) && in_array( 'billing_state', $billing_fields, true ) ) {
return 'base';
}
}

return $option_value;
Expand Down

0 comments on commit 9c92297

Please sign in to comment.