Skip to content

Commit bea5f04

Browse files
committed
fix: hide description in component mode for CC Blocks checkout
1 parent a9850a7 commit bea5f04

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Gateways/Blocks/MoneiCCBlocksSupport.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,16 @@ public function get_payment_method_data() {
9494
if ( ! $card_input_style ) {
9595
$card_input_style = '{"base": {"height": "50"}, "input": {"background": "none"}}';
9696
}
97+
98+
$redirect_mode = $this->get_setting( 'cc_mode' ) ?? 'no';
99+
$description = '';
100+
if ( 'yes' === $redirect_mode && $this->gateway->description !== ' ' ) {
101+
$description = $this->gateway->description;
102+
}
103+
97104
$data = array(
98105
'title' => $this->gateway->title,
99-
'description' => $this->gateway->description === ' ' ? '' : $this->gateway->description,
106+
'description' => $description,
100107
'logo' => WC_Monei()->plugin_url() . '/public/images/monei-cards.svg',
101108
'cardholderName' => esc_attr__( 'Cardholder Name', 'monei' ),
102109
'nameErrorString' => esc_html__( 'Please enter a valid name. Special characters are not allowed.', 'monei' ),
@@ -111,7 +118,7 @@ public function get_payment_method_data() {
111118

112119
// yes: redirect the customer to the Hosted Payment Page.
113120
// no: credit card input will be rendered directly on the checkout page
114-
'redirect' => $this->get_setting( 'cc_mode' ) ?? 'no',
121+
'redirect' => $redirect_mode,
115122

116123
// yes: Can save credit card and use saved cards.
117124
// no: Cannot save/use

0 commit comments

Comments
 (0)