Recently working with Farmart and Nest for a client, I saw a simple change that will improve the vendor’s flow when creating a withdrawal request, which is to rectify the withdrawal field with the vendor’s current balance, already discounted by the fee if it is active.
One suggestion is to update the next versions of the marketplace plugin: /src/Forms/VendorWithdrawalForm.php
Original file:
->add(
'amount',
NumberField::class,
NumberFieldOption::make()
->label(trans('plugins/marketplace::withdrawal.forms.amount_with_balance', ['balance' => format_price($balance)]))
->required()
->placeholder(trans('plugins/marketplace::withdrawal.forms.amount_placeholder'))
->attributes([
'data-counter' => 120,
'max' => $balance
])
->disabled($exists)
->helperText($fee ? trans(
'plugins/marketplace::withdrawal.forms.fee_helper',
['fee' => format_price($fee)]
) : '')
)
Update file:
->add(
'amount',
NumberField::class,
NumberFieldOption::make()
->label(trans('plugins/marketplace::withdrawal.forms.amount_with_balance', ['balance' => format_price($balance)]))
->required()
->placeholder(trans('plugins/marketplace::withdrawal.forms.amount_placeholder'))
->attributes([
'data-counter' => 120,
'max' => $balance,
'value' => $balance - $fee ?? 0
])
->disabled($exists)
->helperText($fee ? trans(
'plugins/marketplace::withdrawal.forms.fee_helper',
['fee' => format_price($fee)]
) : '')
)
We add the value attribute to the field and insert the balance value of the vendor account, deducting the withdrawal fee if it is activated, otherwise 0 is deducted, leaving the total withdrawal from the balance.
With this change we have a faster withdrawal request flow, if the vendor wants to withdraw an amount smaller than his balance he can change the field