Skip to content

Commit bb8af07

Browse files
committed
Add workaround for race condition in block
1 parent 66f190d commit bb8af07

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

modules/ppcp-wc-gateway/src/WCGatewayModule.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,16 @@ function ( WC_Order $wc_order ) use ( $set_order_contacts ): void {
10371037
$set_order_contacts( $wc_order );
10381038
}
10391039
);
1040+
// There is a race condition in express block checkout, the contacts set in woocommerce_paypal_payments_contacts_added
1041+
// may get reverted by another ajax WC request. So we set them again after that.
1042+
add_action(
1043+
'woocommerce_store_api_cart_update_order_from_request',
1044+
function ( WC_Order $wc_order ) use ( $set_order_contacts ): void {
1045+
// This hook fires for all methods, but we do not do anything if the meta is not set
1046+
// so probably no need to add additional checks.
1047+
$set_order_contacts( $wc_order );
1048+
}
1049+
);
10401050
}
10411051

10421052
/**

0 commit comments

Comments
 (0)