Improve the settings messages

This commit is contained in:
Narek Zakarian 2022-08-19 16:23:54 +04:00
parent 8d6ce555fa
commit 78d3e06937

View file

@ -949,8 +949,8 @@ return array(
'title' => __( 'Tracking', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'desc_tip' => true,
'label' => __( 'Enable tracking', 'woocommerce-paypal-payments' ),
'description' => __( 'Enable tracking', 'woocommerce-paypal-payments' ),
'label' => $container->get( 'wcgateway.settings.tracking-label' ),
'description' => __( 'Allows to send shipment tracking numbers to PayPal for PayPal transactions.', 'woocommerce-paypal-payments' ),
'default' => false,
'screens' => array(
State::STATE_ONBOARDED,
@ -2456,10 +2456,33 @@ return array(
return true;
}
if ( $pui_helper->is_pui_ready_in_admin() ) {
if ( $pui_helper->is_pui_enabled() ) {
return true;
}
return false;
},
'wcgateway.settings.tracking-label' => static function ( ContainerInterface $container ): string {
$tracking_label = __( 'Enable tracking information feature on your store.', 'woocommerce-paypal-payments' );
$is_tracking_available = $container->get( 'order-tracking.is-tracking-available' );
if ( $is_tracking_available ) {
return $tracking_label;
}
$tracking_label .= sprintf(
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
__(
' To use tracking features, you must %1$senable tracking on your account%2$s.',
'woocommerce-paypal-payments'
),
'<a
href="https://docs.woocommerce.com/document/woocommerce-paypal-payments/#enable-tracking-on-your-live-account"
target="_blank"
>',
'</a>'
);
return $tracking_label;
},
);