Display vault message on pay later label if vault enabled

This commit is contained in:
dinamiko 2021-05-21 11:11:01 +02:00
parent d1f24125c8
commit 33b3a7c7cb

View file

@ -1807,7 +1807,6 @@ return array(
unset( $fields['disable_funding']['options']['card'] );
}
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
/**
* Depending on your store location, some credit cards can't be used.
* Here, we filter them out.
@ -1816,6 +1815,7 @@ return array(
*
* @var DccApplies $dcc_applies
*/
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
$card_options = $fields['disable_cards']['options'];
foreach ( $card_options as $card => $label ) {
if ( $dcc_applies->can_process_card( $card ) ) {
@ -1825,6 +1825,18 @@ return array(
}
$fields['disable_cards']['options'] = $card_options;
$fields['card_icons']['options'] = $card_options;
/**
* Display vault message on Pay Later label if vault is enabled.
*/
$settings = $container->get( 'wcgateway.settings' );
if ( $settings->has( 'vault_enabled' ) && $settings->get( 'vault_enabled' ) ) {
$message = __( "You have PayPal vaulting enabled, that's why Pay Later Messaging options are unavailable now. You cannot use both features at the same time.", 'woocommerce-paypal-payments' );
$fields['message_enabled']['label'] = $message;
$fields['message_product_enabled']['label'] = $message;
$fields['message_cart_enabled']['label'] = $message;
}
return $fields;
},