Skip to content

Commit 3f3315d

Browse files
committed
feat: add hide title option for all payment methods
Add 'Hide Title' checkbox setting to all payment methods allowing merchants to show only the payment method logo on checkout. Changes: - Added hide_title checkbox to all payment method settings files - Updated all payment gateway classes to respect hide_title setting - When enabled, only the logo is displayed (if not also hidden) - Added title field to Apple/Google Pay settings (was previously hardcoded) This gives merchants full control over payment method presentation.
1 parent 32cb917 commit 3f3315d

12 files changed

+67
-6
lines changed

includes/admin/monei-apple-google-settings.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@
3333
'label' => __( 'Enable Apple Pay and Google Pay by MONEI', 'monei' ),
3434
'default' => 'no',
3535
),
36+
'title' => array(
37+
'title' => __( 'Title', 'monei' ),
38+
'type' => 'text',
39+
'description' => __( 'The payment method title a user sees during checkout.', 'monei' ),
40+
'default' => __( 'Apple Pay / Google Pay', 'monei' ),
41+
'desc_tip' => true,
42+
),
43+
'hide_title' => array(
44+
'title' => __( 'Hide Title', 'monei' ),
45+
'type' => 'checkbox',
46+
'label' => __( 'Hide payment method title', 'monei' ),
47+
'default' => 'no',
48+
'description' => __( 'Hide payment method title in the checkout, showing only the logo.', 'monei' ),
49+
'desc_tip' => true,
50+
),
3651
'payment_request_style' => array(
3752
'title' => __( 'Apple Pay / Google Pay Style', 'monei' ),
3853
'type' => 'textarea',

includes/admin/monei-bizum-settings.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@
6161
'default' => __( 'Bizum', 'monei' ),
6262
'desc_tip' => true,
6363
),
64+
'hide_title' => array(
65+
'title' => __( 'Hide Title', 'monei' ),
66+
'type' => 'checkbox',
67+
'label' => __( 'Hide payment method title', 'monei' ),
68+
'default' => 'no',
69+
'description' => __( 'Hide payment method title in the checkout, showing only the logo.', 'monei' ),
70+
'desc_tip' => true,
71+
),
6472
'hide_logo' => array(
6573
'title' => __( 'Hide Logo', 'monei' ),
6674
'type' => 'checkbox',

includes/admin/monei-cc-settings.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@
6161
'default' => __( 'Credit Card', 'monei' ),
6262
'desc_tip' => true,
6363
),
64+
'hide_title' => array(
65+
'title' => __( 'Hide Title', 'monei' ),
66+
'type' => 'checkbox',
67+
'label' => __( 'Hide payment method title', 'monei' ),
68+
'default' => 'no',
69+
'description' => __( 'Hide payment method title in the checkout, showing only the logo.', 'monei' ),
70+
'desc_tip' => true,
71+
),
6472
'hide_logo' => array(
6573
'title' => __( 'Hide Logo', 'monei' ),
6674
'type' => 'checkbox',

includes/admin/monei-mbway-settings.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@
4040
'default' => __( 'MBWay', 'monei' ),
4141
'desc_tip' => true,
4242
),
43+
'hide_title' => array(
44+
'title' => __( 'Hide Title', 'monei' ),
45+
'type' => 'checkbox',
46+
'label' => __( 'Hide payment method title', 'monei' ),
47+
'default' => 'no',
48+
'description' => __( 'Hide payment method title in the checkout, showing only the logo.', 'monei' ),
49+
'desc_tip' => true,
50+
),
4351
'description' => array(
4452
'title' => __( 'Description', 'monei' ),
4553
'type' => 'textarea',

includes/admin/monei-multibanco-settings.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@
4040
'default' => __( 'Multibanco', 'monei' ),
4141
'desc_tip' => true,
4242
),
43+
'hide_title' => array(
44+
'title' => __( 'Hide Title', 'monei' ),
45+
'type' => 'checkbox',
46+
'label' => __( 'Hide payment method title', 'monei' ),
47+
'default' => 'no',
48+
'description' => __( 'Hide payment method title in the checkout, showing only the logo.', 'monei' ),
49+
'desc_tip' => true,
50+
),
4351
'description' => array(
4452
'title' => __( 'Description', 'monei' ),
4553
'type' => 'textarea',

includes/admin/monei-paypal-settings.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@
6161
'default' => __( 'PayPal', 'monei' ),
6262
'desc_tip' => true,
6363
),
64+
'hide_title' => array(
65+
'title' => __( 'Hide Title', 'monei' ),
66+
'type' => 'checkbox',
67+
'label' => __( 'Hide payment method title', 'monei' ),
68+
'default' => 'no',
69+
'description' => __( 'Hide payment method title in the checkout, showing only the logo.', 'monei' ),
70+
'desc_tip' => true,
71+
),
6472
'hide_logo' => array(
6573
'title' => __( 'Hide Logo', 'monei' ),
6674
'type' => 'checkbox',

src/Gateways/PaymentMethods/WCGatewayMoneiAppleGoogle.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public function __construct(
6060
parent::__construct( $paymentMethodsService, $templateManager, $apiKeyService, $moneiPaymentServices );
6161
$this->id = 'monei_apple_google';
6262
$this->method_title = __( 'MONEI - Apple/Google', 'monei' );
63-
$this->title = __( 'Google Pay', 'monei' );
63+
$hide_title = ( ! empty( $this->get_option( 'hide_title' ) && 'yes' === $this->get_option( 'hide_title' ) ) ) ? true : false;
64+
$this->title = ( ! $hide_title && ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : ( $hide_title ? '' : __( 'Apple Pay / Google Pay', 'monei' ) );
6465
$this->description = ( ! empty( $this->get_option( 'description' ) ) ) ? $this->get_option( 'description' ) : '';
6566
$iconUrl = apply_filters( 'woocommerce_monei_icon', WC_Monei()->image_url( 'google-logo.svg' ) );
6667
$iconMarkup = '<img src="' . $iconUrl . '" alt="MONEI" class="monei-icons" />';

src/Gateways/PaymentMethods/WCGatewayMoneiBizum.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ public function __construct(
6161
$this->hide_logo = ( ! empty( $this->get_option( 'hide_logo' ) && 'yes' === $this->get_option( 'hide_logo' ) ) ) ? true : false;
6262
$this->icon = ( $this->hide_logo ) ? '' : $iconMarkup;
6363
$this->redirect_flow = ( ! empty( $this->get_option( 'bizum_mode' ) && 'yes' === $this->get_option( 'bizum_mode' ) ) ) ? true : false;
64-
$this->title = ( ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : '';
64+
$hide_title = ( ! empty( $this->get_option( 'hide_title' ) && 'yes' === $this->get_option( 'hide_title' ) ) ) ? true : false;
65+
$this->title = ( ! $hide_title && ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : '';
6566
$this->description = ( ! empty( $this->get_option( 'description' ) ) ) ? $this->get_option( 'description' ) : '';
6667
$this->status_after_payment = ( ! empty( $this->get_option( 'orderdo' ) ) ) ? $this->get_option( 'orderdo' ) : '';
6768
$this->api_key = $this->getApiKey();

src/Gateways/PaymentMethods/WCGatewayMoneiCC.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ public function __construct(
9595
$this->icon = ( $this->hide_logo || $hasCardBrands ) ? '' : $iconMarkup;
9696
$this->redirect_flow = ( ! empty( $this->get_option( 'cc_mode' ) && 'yes' === $this->get_option( 'cc_mode' ) ) ) ? true : false;
9797
$this->testmode = $this->getTestmode();
98-
$this->title = ( ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : '';
98+
$hide_title = ( ! empty( $this->get_option( 'hide_title' ) && 'yes' === $this->get_option( 'hide_title' ) ) ) ? true : false;
99+
$this->title = ( ! $hide_title && ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : '';
99100
$this->description = ( ! empty( $this->get_option( 'description' ) ) ) ? $this->get_option( 'description' ) : '';
100101
$this->status_after_payment = ( ! empty( $this->get_option( 'orderdo' ) ) ) ? $this->get_option( 'orderdo' ) : '';
101102
$this->account_id = $this->getAccountId();

src/Gateways/PaymentMethods/WCGatewayMoneiMBWay.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public function __construct(
5555
// Settings variable
5656
$this->hide_logo = ( ! empty( $this->get_option( 'hide_logo' ) && 'yes' === $this->get_option( 'hide_logo' ) ) ) ? true : false;
5757
$this->icon = ( $this->hide_logo ) ? '' : $iconMarkup;
58-
$this->title = ( ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : '';
58+
$hide_title = ( ! empty( $this->get_option( 'hide_title' ) && 'yes' === $this->get_option( 'hide_title' ) ) ) ? true : false;
59+
$this->title = ( ! $hide_title && ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : '';
5960
$this->description = ( ! empty( $this->get_option( 'description' ) ) ) ? $this->get_option( 'description' ) : '';
6061
$this->status_after_payment = ( ! empty( $this->get_option( 'orderdo' ) ) ) ? $this->get_option( 'orderdo' ) : '';
6162
$this->api_key = $this->getApiKey();

0 commit comments

Comments
 (0)