diff --git a/includes/api/coupon-apply.php b/includes/api/coupon-apply.php index e3a8567e..1ea29dae 100644 --- a/includes/api/coupon-apply.php +++ b/includes/api/coupon-apply.php @@ -60,22 +60,19 @@ function applyCouponOnCart(WP_REST_Request $request) } //check woo-discount-rule plugin disabling the coupons - $discountOptions = get_option( 'woo-discount-config-v2', []); - if (!empty($discountOptions)) - { + $discountOptions = get_option('woo-discount-config-v2', []); + if (!empty($discountOptions)) { $isCouponEnabled = $discountOptions['disable_coupon_when_rule_applied']; - if ($isCouponEnabled == 'disable_coupon') - { - $response["failure_reason"] = "Coupon feature disabled"; - $response["failure_code"] = "INVALID_COUPON"; - $logObj["response"] = $response; + if ($isCouponEnabled == 'disable_coupon') { + $response["failure_reason"] = "Coupon feature disabled"; + $response["failure_code"] = "INVALID_COUPON"; + $logObj["response"] = $response; rzpLogError(json_encode($logObj)); return new WP_REST_Response($response, 400); } } - if (empty($coupon->get_email_restrictions()) === false) { if ($email == "") { diff --git a/includes/api/coupon-get.php b/includes/api/coupon-get.php index b395a89b..4c240d06 100755 --- a/includes/api/coupon-get.php +++ b/includes/api/coupon-get.php @@ -68,16 +68,13 @@ function getCouponList($request) ); //check woo-discount-rule plugin disabling the coupons - $discountOptions = get_option( 'woo-discount-config-v2', []); - if (!empty($discountOptions)) - { + $discountOptions = get_option('woo-discount-config-v2', []); + if (!empty($discountOptions)) { $isCouponEnabled = $discountOptions['disable_coupon_when_rule_applied']; - if ($isCouponEnabled == 'disable_coupon') - { - $args = array(); + if ($isCouponEnabled == 'disable_coupon') { + $args = array(); } } - $coupons = new WP_Query($args);