Skip to content

Commit acb24f0

Browse files
committed
Account fields adding billing_email break stuff.
1 parent b556e0d commit acb24f0

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

includes/class-wc-gateway-amazon-payments-advanced.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,7 @@ protected function is_logged_in() {
322322
}
323323

324324
public function hijack_checkout_fields( $checkout ) {
325-
$has_billing_fields = ( isset( $checkout->checkout_fields['billing'] ) && is_array( $checkout->checkout_fields['billing'] ) );
326-
if ( $has_billing_fields ) {
327-
$this->hijack_checkout_field_account( $checkout );
328-
}
325+
$this->hijack_checkout_field_account( $checkout );
329326

330327
// During an Amazon checkout, the standard billing and shipping fields need to be
331328
// "removed" so that we don't trigger a false negative on form validation -
@@ -412,14 +409,6 @@ public function hijack_checkout_fields( $checkout ) {
412409
* @param WC_Checkout $checkout WC_Checkout instance.
413410
*/
414411
protected function hijack_checkout_field_account( $checkout ) {
415-
$billing_fields_to_copy = array(
416-
'billing_first_name' => '',
417-
'billing_last_name' => '',
418-
'billing_email' => '',
419-
);
420-
421-
$billing_fields_to_merge = array_intersect_key( $checkout->checkout_fields['billing'], $billing_fields_to_copy );
422-
423412
/**
424413
* WC 3.0 changes a bit a way to retrieve fields.
425414
*
@@ -441,12 +430,6 @@ protected function hijack_checkout_field_account( $checkout ) {
441430
? $checkout_fields['account']
442431
: array();
443432

444-
$checkout_fields['account'] = array_merge( $billing_fields_to_merge, $checkout_fields['account'] );
445-
446-
if ( isset( $checkout_fields['account']['billing_email']['class'] ) ) {
447-
$checkout_fields['account']['billing_email']['class'] = array();
448-
}
449-
450433
$checkout->checkout_fields = $checkout_fields;
451434
}
452435

0 commit comments

Comments
 (0)