From 3a82b9d23c513e21b069ed9def67ac2e83da723d Mon Sep 17 00:00:00 2001 From: Dat Hoang Date: Thu, 3 Sep 2020 20:01:24 +0700 Subject: [PATCH] Handle OnePay options in the settings page better If a payment gateway option is NOT checked, it should not echo any link to configuration pages. --- inc/class-wooviet-admin-page.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/inc/class-wooviet-admin-page.php b/inc/class-wooviet-admin-page.php index 3f5dcc6..cb6c16b 100644 --- a/inc/class-wooviet-admin-page.php +++ b/inc/class-wooviet-admin-page.php @@ -106,7 +106,9 @@ class WooViet_Admin_Page { if ( 'VND' == get_woocommerce_currency() ) { _e( 'OnePay can work on your site.', 'woo-viet' ); echo '
'; - echo sprintf( __( 'Please configure this gateway under WooCommerce -> Settings -> Checkout.', 'woo-viet' ), admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wooviet_onepay_domestic' ) ); + if ( 'yes' == $settings['add_onepay_domestic']['enabled'] ) { + echo sprintf( __( 'Please configure this gateway under WooCommerce -> Settings -> Checkout.', 'woo-viet' ), admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wooviet_onepay_domestic' ) ); + } } else { _e( 'This gateway is not active on your site. Because OnePay supports VND only.', 'woo-viet' ); } @@ -133,7 +135,9 @@ class WooViet_Admin_Page { if ( 'VND' == get_woocommerce_currency() ) { _e( 'OnePay can work on your site.', 'woo-viet' ); echo '
'; - echo sprintf( __( 'Please configure this gateway under WooCommerce -> Settings -> Checkout.', 'woo-viet' ), admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wooviet_onepay_international' ) ); + if ( 'yes' == $settings['add_onepay_international']['enabled'] ) { + echo sprintf( __( 'Please configure this gateway under WooCommerce -> Settings -> Checkout.', 'woo-viet' ), admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wooviet_onepay_international' ) ); + } } else { _e( 'This gateway is not active on your site. Because OnePay supports VND only.', 'woo-viet' ); }