Skip to content

Commit

Permalink
Handled the test mode for apply coupon feature hiding
Browse files Browse the repository at this point in the history
  • Loading branch information
ChetanGN committed Mar 2, 2022
1 parent 296c66f commit f69aa8e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions woo-razorpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -1876,8 +1876,17 @@ function addAdminSettingsAlertScript()

function disable_coupon_field_on_cart($enabled)
{
if ( is_cart()) {
$enabled = false;
if (isTestModeEnabled()) {
$current_user = wp_get_current_user();
if ($current_user->has_cap( 'administrator' ) || preg_match( '/@razorpay.com$/i', $current_user->user_email )) {
if (is_cart() || is_checkout()) {
$enabled = false;
}
}
} else {
if (is_cart() || is_checkout()) {
$enabled = false;
}
}
return $enabled;
}
Expand Down

0 comments on commit f69aa8e

Please sign in to comment.