From 752f6c26f35c33ffede1f3da9d208ca0e74ae7d8 Mon Sep 17 00:00:00 2001 From: Dat Hoang Date: Thu, 3 Sep 2020 20:54:40 +0700 Subject: [PATCH] Tighten condtions to load support for PP Standard and PP Checkout --- woo-viet.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/woo-viet.php b/woo-viet.php index dfa6a17..10155e8 100644 --- a/woo-viet.php +++ b/woo-viet.php @@ -256,7 +256,10 @@ class WooViet { // Check if "Support VND for the PayPal Standard gateway" is enabled - if ( 'yes' == $settings['vnd_paypal_standard']['enabled'] ) { + if ( 'yes' == $settings['vnd_paypal_standard']['enabled'] + AND class_exists( 'WC_Gateway_PPEC' ) + AND 'VND' == get_woocommerce_currency() + ) { include( WOO_VIET_DIR . 'inc/class-wooviet-vnd-paypal-standard.php' ); $this->VND_PayPal_Standard = new WooViet_VND_PayPal_Standard( $settings['vnd_paypal_standard']['rate'], @@ -267,6 +270,7 @@ class WooViet { // Check if "Support VND for the PayPal Express Checkout gateway" is enabled if ( 'yes' == $settings['vnd_paypal_express_checkout']['enabled'] AND class_exists( 'WC_Gateway_PPEC_Plugin' ) + AND 'VND' == get_woocommerce_currency() ) { include( WOO_VIET_DIR . 'inc/class-wooviet-vnd-paypal-express-checkout.php' ); $this->VND_PayPal_Express_Checkout = new WooViet_VND_PayPal_Express_Checkout(