Skip to content

Commit

Permalink
Merge pull request #230 from razorpay/1cc-handle-test-mode
Browse files Browse the repository at this point in the history
Handled the test mode for apply coupon feature hiding
  • Loading branch information
ChetanGN authored Mar 2, 2022
2 parents 296c66f + f69aa8e commit 8aa5f7e
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 8aa5f7e

Please sign in to comment.