@@ -523,7 +523,12 @@ function kkd_pff_paystack_editor_add_quantity_data()
523523 $ quantity = '10 ' ;
524524 }
525525 if ($ inventory == "" ) {
526- $ inventory = '1 ' ;
526+ if ($ sold !== "" ){
527+ $ inventory = $ sold ;
528+ }else {
529+ $ inventory = '1 ' ;
530+ }
531+
527532 }
528533 if ($ sold == "" ){
529534 $ sold = '0 ' ;
@@ -547,16 +552,26 @@ function kkd_pff_paystack_editor_add_quantity_data()
547552 }
548553 if ($ usequantity == "yes " ){
549554
550- echo '<p>Inventory Payment:</p><small>Set maximum available items in stock</small> ' ;
555+ echo '<p>Max payable quantity:</p> ' ;
556+ echo '<input type="number" min="1" name="_quantity" value=" ' . $ quantity . '" class="widefat pf-number" />
557+ <small>Your users only get to pay in quantities if the from amount is not set to zero and recur is set to none.</small> ' ;
558+ echo '<p>Unit of quantity:</p> ' ;
559+ echo '<input type="text" name="_quantityunit" value=" ' . $ quantityunit . '" class="widefat" />
560+ <small>What is the unit of this quantity? Default is <code>Quantity</code>.</small> ' ;
561+
562+
563+ echo '<p>Inventory Payment:</p> ' ;
551564 echo '
552565 <select class="form-control" name="_useinventory" style="width:100%;">
553566 <option value="no" ' .kkd_pff_paystack_txncheck ('no ' , $ useinventory ).'>No</option>
554567 <option value="yes" ' .kkd_pff_paystack_txncheck ('yes ' , $ useinventory ).'>Yes</option>
555- </select> ' ;
568+ </select>
569+ <small>Set maximum available items in stock</small>
570+ ' ;
556571
557572
558573 }
559- if ($ useinventory == "yes " ){
574+ if ($ useinventory == "yes " && $ usequantity == " yes " ){
560575 echo '<p>Total Inventory</p> ' ;
561576 echo '<input type="number" min=" ' .$ sold .'" name="_inventory" value=" ' . $ inventory . '" class="widefat pf-number" /> ' ;
562577 echo '<p>In stock</p> ' ;
@@ -565,12 +580,7 @@ function kkd_pff_paystack_editor_add_quantity_data()
565580
566581 }
567582
568- echo '<p>Max payable quantity:</p> ' ;
569- echo '<input type="number" min="1" name="_quantity" value=" ' . $ quantity . '" class="widefat pf-number" />
570- <small>Your users only get to pay in quantities if the from amount is not set to zero and recur is set to none.</small> ' ;
571- echo '<p>Unit of quantity:</p> ' ;
572- echo '<input type="text" name="_quantityunit" value=" ' . $ quantityunit . '" class="widefat" />
573- <small>What is the unit of this quantity? Default is <code>Quantity</code>.</small> ' ;
583+
574584 }
575585 function kkd_pff_paystack_editor_add_agreement_data ()
576586 {
0 commit comments