Skip to content

Commit 2acaa51

Browse files
committed
Display default titles if unset.
1 parent 9627ac4 commit 2acaa51

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

includes/Gateway.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,32 @@ public function __construct() {
145145
$this->digital_wallet = new Digital_Wallet( $this );
146146
}
147147

148+
/**
149+
* Get the payment method title or show default if not set.
150+
*
151+
* @since x.x.x
152+
* @return string payment method title to show on checkout
153+
*/
154+
public function get_title() {
155+
if ( $this->title ) {
156+
return $this->title;
157+
}
158+
return esc_html__( 'Credit Card', 'woocommerce-square' );
159+
}
160+
161+
/**
162+
* Get the payment method description or show default if not set.
163+
*
164+
* @since x.x.x
165+
* @return string payment method description to show on checkout
166+
*/
167+
public function get_description() {
168+
if ( $this->description ) {
169+
return $this->description;
170+
}
171+
return esc_html__( 'Pay securely using your credit card.', 'woocommerce-square' );
172+
}
173+
148174
/**
149175
* Ajax callback to return payment token by token ID.
150176
*

includes/Gateway/Cash_App_Pay_Gateway.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,26 @@ public function add_admin_notices() {
239239
* Get the default payment method title, which is configurable within the
240240
* admin and displayed on checkout
241241
*
242-
* @since 4.5.0
242+
* @since x.x.x
243243
* @return string payment method title to show on checkout
244244
*/
245245
protected function get_default_title() {
246246
return esc_html__( 'Cash App Pay', 'woocommerce-square' );
247247
}
248248

249+
/**
250+
* Get the default payment method title, which is configurable within the
251+
* admin and displayed on checkout
252+
*
253+
* @since x.x.x
254+
* @return string payment method title to show on checkout
255+
*/
256+
public function get_title() {
257+
if ( $this->title ) {
258+
return $this->title;
259+
}
260+
return $this->get_default_title();
261+
}
249262

250263
/**
251264
* Get the default payment method description, which is configurable

includes/Gateway/Gift_Card.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,19 @@ public function __construct() {
6161
add_filter( 'woocommerce_checkout_order_processed', array( $this, 'delete_sessions' ) );
6262
}
6363

64+
/**
65+
* Get the payment method title or show default if not set.
66+
*
67+
* @since x.x.x
68+
* @return string payment method title to show on checkout
69+
*/
70+
public function get_title() {
71+
if ( $this->title ) {
72+
return $this->title;
73+
}
74+
return esc_html__( 'Square Gift Card', 'woocommerce-square' );
75+
}
76+
6477
/**
6578
* Returns true if the gateway is properly configured to perform transactions
6679
*

0 commit comments

Comments
 (0)