Last active
December 10, 2019 13:31
-
-
Save iamsathyaseelan/68fa9175d9b3cf19a2c44c70c03727dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Example:https://nimb.ws/PumFqI | |
if(!function_exists("rnoc_exit_intent_popup_condition_coupons")){ | |
function rnoc_exit_intent_popup_condition_coupons($to_replace){ | |
$cart_total = 0; | |
if(function_exists("WC")){ | |
$cart_total = WC()->cart->total; | |
} | |
$coupon_code = ""; | |
if($cart_total >100){ | |
$coupon_code = "test1"; | |
}elseif($cart_total >50){ | |
$coupon_code = "test2"; | |
} | |
if (!empty($coupon_code)) { | |
$coupon_data = '?rnoc_on_exit_coupon_code=' . $coupon_code; | |
$to_replace['coupon_code'] = $coupon_code; | |
$to_replace['checkout_url'] = wc_get_checkout_url().$coupon_data; | |
$to_replace['cart_url'] = wc_get_cart_url().$coupon_data; | |
} | |
return $to_replace; | |
} | |
} | |
add_filter("rnoc_exit_intent_popup_short_codes","rnoc_exit_intent_popup_condition_coupons"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment