Merge pull request #536 from woocommerce/PCP-564-pay-for-order-guest-failing

Check if payer's Email and name are set before sending data
This commit is contained in:
Emili Castells 2022-04-12 09:15:15 +02:00 committed by GitHub
commit 50e282aba5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 4 deletions

View file

@ -226,7 +226,7 @@ class OrderEndpoint {
'application_context' => $this->application_context_repository
->current_context( $shipping_preference )->to_array(),
);
if ( $payer ) {
if ( $payer && ! empty( $payer->email_address() ) && ! empty( $payer->name() ) ) {
$data['payer'] = $payer->to_array();
}
if ( $payment_token ) {