Skip to content

Commit

Permalink
Code beautify
Browse files Browse the repository at this point in the history
  • Loading branch information
ChetanGN committed Mar 2, 2022
1 parent bbd0b59 commit 45af465
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
15 changes: 6 additions & 9 deletions includes/api/coupon-apply.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "") {
Expand Down
11 changes: 4 additions & 7 deletions includes/api/coupon-get.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 45af465

Please sign in to comment.