-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHidePaymentGateWaysIfTotalCartIsZero.php
54 lines (44 loc) · 1.35 KB
/
HidePaymentGateWaysIfTotalCartIsZero.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* Hide paymentGateways When Total at Cart Checkout is Zero
* @package WHMCS
* @author Aladdin Jiroun
*/
if (!defined("WHMCS"))
die("This file cannot be accessed directly");
// You Will need to select Payment Method something other than credit card like paypal or paypalcheckout
// edit to paypalcheckout if you using this module
add_hook('ClientAreaPageCart', 1, function($vars) {
if ($vars['rawtotal'] == 0.00)
{
add_hook('ClientAreaFooterOutput', 1, function($vars) {
$v = "input[value='paypal']";
$return = '
<script>
document.querySelector("'.$v.'").checked = true;
const PGC = document.getElementById("paymentGatewaysContainer");
PGC.style.display = "none";
</script>
';
return $return;
});
}
});
// add_hook('ClientAreaPageCart', 1, function($vars) {
// if ($vars['rawtotal'] == 0.00)
// {
// add_hook('ClientAreaFooterOutput', 1, function($vars) {
// $return = '
// <script>
// const PGC = document.getElementById("paymentGatewaysContainer");
// PGC.style.display = "none";
// setTimeout(function(){
// const CCIF = document.getElementById("creditCardInputFields");
// CCIF.style.display = "none";
// }, 1000);
// </script>
// ';
// return $return;
// });
// }
// });