Skip to content

Commit

Permalink
Merge pull request #837 from woocommerce/php8
Browse files Browse the repository at this point in the history
Use is_callable() instead of method_exists() in check
  • Loading branch information
jorgeatorres authored Nov 19, 2020
2 parents ed4161e + df9264c commit 1942189
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion includes/class-wc-gateway-ppec-checkout-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function filter_default_address_fields( $fields ) {
return $fields;
}

if ( method_exists( WC()->cart, 'needs_shipping' ) && ! WC()->cart->needs_shipping() && 'no' === wc_gateway_ppec()->settings->require_billing ) {
if ( is_callable( array( WC()->cart, 'needs_shipping' ) ) && ! WC()->cart->needs_shipping() && 'no' === wc_gateway_ppec()->settings->require_billing ) {
$not_required_fields = array( 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'postcode', 'country' );
foreach ( $not_required_fields as $not_required_field ) {
if ( array_key_exists( $not_required_field, $fields ) ) {
Expand Down

0 comments on commit 1942189

Please sign in to comment.