Open OnePay for VND only

This commit is contained in:
htdat
2017-04-22 12:47:24 +07:00
parent 6c76275499
commit 8df0f11869
2 changed files with 13 additions and 2 deletions
+10 -1
View File
@@ -101,7 +101,16 @@ class WooViet_Admin_Page {
<br/> <br/>
<label for=""> <label for="">
<?php <?php
echo sprintf( __( 'Please configure this gateway under <a href="%s">WooCommerce -> Settings -> Checkout</a>', 'woo-viet' ), admin_url( 'admin.php?page=wc-settings&tab=checkout' ) ); echo sprintf( __( 'Your store currency is <code>%s</code>. ', 'woo-viet' ), get_woocommerce_currency() );
// Handle whether or not the store current is VND
if ( 'VND' == get_woocommerce_currency() ) {
_e( 'OnePay can work on your site.', 'woo-viet' );
echo '<br/>';
echo sprintf( __( 'Please configure this gateway under <a href="%s">WooCommerce -> Settings -> Checkout</a>.', 'woo-viet' ), admin_url( 'admin.php?page=wc-settings&tab=checkout' ) );
} else {
_e( '<span style="color: red" ">This gateway is not active on your site. Because OnePay supports VND only.</span>', 'woo-viet' );
}
?> ?>
</label> </label>
</td> </td>
+3 -1
View File
@@ -138,7 +138,9 @@ class WooViet {
$settings = self::get_settings(); $settings = self::get_settings();
// Check if "Add the OnePay Domestic Gateway" is enabled // Check if "Add the OnePay Domestic Gateway" is enabled
if ( 'yes' == $settings['add_onepay_domestic']['enabled'] ) { if ( 'yes' == $settings['add_onepay_domestic']['enabled']
AND 'VND' == get_woocommerce_currency()
) {
include( 'inc/class-wooviet-onepay-domestic.php' ); include( 'inc/class-wooviet-onepay-domestic.php' );
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateway_class' ) ); add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateway_class' ) );