Fix bug where active payment methods were checked too early
This commit is contained in:
parent
dfe5151f7f
commit
080cdbeac2
|
@ -33,6 +33,12 @@ const registeredStore = registerStore< State >( STORE_KEY, {
|
|||
|
||||
registeredStore.subscribe( pushChanges );
|
||||
registeredStore.subscribe( async () => {
|
||||
const isInitialized =
|
||||
wpDataSelect( STORE_KEY ).hasFinishedResolution( 'getCartData' );
|
||||
|
||||
if ( ! isInitialized ) {
|
||||
return;
|
||||
}
|
||||
await checkPaymentMethodsCanPay();
|
||||
await checkPaymentMethodsCanPay( true );
|
||||
} );
|
||||
|
|
|
@ -34,6 +34,7 @@ register( store );
|
|||
|
||||
const isEditor = !! wpDataSelect( 'core/editor' );
|
||||
|
||||
// This is needed to ensure that the payment methods are displayed in the editor
|
||||
if ( isEditor ) {
|
||||
subscribe( async () => {
|
||||
await checkPaymentMethodsCanPay();
|
||||
|
|
Loading…
Reference in New Issue