Skip to content

Commit 5b8d5af

Browse files
Add condition to not run code if order payment method is not cko
1 parent f374109 commit 5b8d5af

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

woocommerce-gateway-checkout-com/includes/settings/class-wc-checkoutcom-webhook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public function is_registered( $url = '' ): string {
207207
}
208208

209209
foreach ( $webhooks as $item ) {
210-
if ( str_contains( $item['url'], $url ) ) {
210+
if ( false !== strpos( $item['url'], $url ) ) {
211211
$this->url_is_registered = $item['url'];
212212

213213
return $this->url_is_registered;

woocommerce-gateway-checkout-com/includes/settings/class-wc-checkoutcom-workflows.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function is_registered( $url = '' ): string {
6868

6969
foreach ( $webhooks as $item ) {
7070

71-
if ( str_contains( $item['name'], $url ) ) {
71+
if ( false !== strpos( $item['name'], $url ) ) {
7272
$this->url_is_registered = $item['name'];
7373

7474
return $this->url_is_registered;

woocommerce-gateway-checkout-com/readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: checkout, payments, credit card, payment gateway, apple pay, google pay, p
44
Requires at least: 4.0
55
Stable tag: trunk
66
Requires PHP: 7.2
7-
Tested up to: 5.9.3
7+
Tested up to: 6.0
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010

woocommerce-gateway-checkout-com/woocommerce-gateway-checkout-com.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ function cko_refund() {
244244
add_action( 'woocommerce_order_item_add_action_buttons', 'action_woocommerce_order_item_add_action_buttons', 10, 1 );
245245
function action_woocommerce_order_item_add_action_buttons( $order ) {
246246

247+
// Check order payment method is checkout.
248+
if ( false === strpos( $order->get_payment_method(), 'wc_checkout_com_' ) ) {
249+
return;
250+
}
251+
247252
$order_status = $order->get_status();
248253
$auth_status = str_replace('wc-', '', WC_Admin_Settings::get_option('ckocom_order_authorised', 'on-hold'));
249254
$capture_status = str_replace('wc-', '', WC_Admin_Settings::get_option('ckocom_order_captured', 'processing'));
@@ -447,7 +452,7 @@ function cko_is_nas_account() {
447452

448453
$core_settings = get_option( 'woocommerce_wc_checkout_com_cards_settings' );
449454

450-
return isset( $core_settings['ckocom_account_type'] ) && str_contains( $core_settings['ckocom_account_type'], 'NAS' );
455+
return isset( $core_settings['ckocom_account_type'] ) && ( 'NAS' === $core_settings['ckocom_account_type'] );
451456
}
452457

453458
/**

0 commit comments

Comments
 (0)