Skip to content

Commit c3e973b

Browse files
committed
v1.1.0 added quantity.
1 parent 25910e1 commit c3e973b

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

README.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ You can also follow us on Twitter! **[@paystack](http://twitter.com/paystack)**
7777

7878

7979
== Changelog ==
80+
= 1.1.0 =
81+
* Added quantity option for minimal selling of items in quantity.
8082
= 1.0.9 =
8183
* Updated to use Paystack plans filter before plan creation.
8284
= 1.0.8 =

public/class-paystack-forms-public.php

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -666,20 +666,20 @@ function kkd_pff_paystack_form_shortcode($atts) {
666666

667667
echo '</div>
668668
</div>';
669-
if ($usequantity == 'yes') {
669+
if ($recur == 'no' && $usequantity == 'yes') {
670670
echo '<div class="span12 unit">
671-
<label class="label">Quantity</label>
672-
<div class="select">
673-
<input type="hidden" value="'.$amount.'" id="pf-qamount"/>
674-
<select class="form-control" id="pf-quantity" name="pf-quantity" >';
675-
$max = $quantity+1;
676-
for ($i=1; $i < $max; $i++) {
677-
echo ' <option value="'.$i.'">'.$i.'</ption>';
678-
}
679-
echo '</select>
680-
<i></i>
681-
</div>
682-
</div>';
671+
<label class="label">Quantity</label>
672+
<div class="select">
673+
<input type="hidden" value="'.$amount.'" id="pf-qamount"/>
674+
<select class="form-control" id="pf-quantity" name="pf-quantity" >';
675+
$max = $quantity+1;
676+
for ($i=1; $i < $max; $i++) {
677+
echo ' <option value="'.$i.'">'.$i.'</ption>';
678+
}
679+
echo '</select>
680+
<i></i>
681+
</div>
682+
</div>';
683683
}
684684

685685
if ($recur == 'optional') {
@@ -924,6 +924,12 @@ function kkd_pff_paystack_submit_action() {
924924
if ($usequantity == 'no') {
925925
$amount = (int)str_replace(' ', '', $formamount);
926926
}else{
927+
$fixedmetadata[] = [
928+
'display_name' => 'Unit Price',
929+
'variable_name' => 'Unit_Price',
930+
'type' => 'text',
931+
'value' => $currency.number_format($formamount)
932+
];
927933
$quantity = $_POST["pf-quantity"];
928934
$unitamount = (int)str_replace(' ', '', $formamount);
929935
$amount = $quantity*$unitamount;
@@ -1210,7 +1216,7 @@ function kkd_pff_paystack_confirm_payment() {
12101216
$unitamount = (int)str_replace(' ', '', $amount);
12111217
$amount = $quantity*$unitamount;
12121218
}
1213-
1219+
12141220

12151221
if ($txncharge == 'customer') {
12161222
$percent = (1.55/100)*$amount;

0 commit comments

Comments
 (0)