Skip to content

Commit 4697e32

Browse files
committed
Append button if payment-btn-container not found
1 parent c2f5202 commit 4697e32

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

modules/gateways/paystack.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,12 @@ function paystack_link($params)
135135
var paymentMethod = $(\'select[name="gateway"]\').val();
136136
if (paymentMethod === \'paystack\') {
137137
$(\'.payment-btn-container2\').hide();
138-
$(\'.payment-btn-container\').append(\'<button type="button"'.
139-
' onclick="payWithPaystack()"> Pay with ATM Card</button>\');
138+
var toAppend = \'<button type="button"'.
139+
' onclick="payWithPaystack()"> Pay with ATM Card</button>\';
140+
$(\'.payment-btn-container\').append(toAppend);
141+
if($(\'.payment-btn-container\').length===0){
142+
$(\'select[name="gateway"]\').after(toAppend);
143+
}
140144
}
141145
});
142146
</script>

0 commit comments

Comments
 (0)