Hi @minovec,
Thanks for reaching out to our support forum. Is that you want to debit amount from customer wallet for partial payment?
Thank and Regards,
Subrata Mal
@minovec,
Please use below code snippet to themes function.php file.
add_action('woocommerce_checkout_order_processed', 'process_woo_wallet_partial_payment', 40, 1);
function process_woo_wallet_partial_payment($order_id) {
$order = wc_get_order($order_id);
if (get_post_meta($order_id, '_via_wallet_payment', true) && !get_post_meta($order_id, '_partial_pay_through_wallet_compleate', true)) {
$transaction_id = woo_wallet()->wallet->debit($order->get_customer_id(), get_post_meta($order_id, '_via_wallet_payment', true), __('For order payment #', 'woo-wallet') . $order->get_id());
if ($transaction_id) {
$order->add_order_note(sprintf(__('%s paid through wallet', 'woo-wallet'), wc_price(get_post_meta($order_id, '_via_wallet_payment', true))));
update_wallet_transaction_meta($transaction_id, '_partial_payment', true, $order->get_id());
update_post_meta($order_id, '_partial_pay_through_wallet_compleate', $transaction_id);
}
}
}
Thanks and Regards,
Subrata Mal
@minovec,
Could you please consider posting a review of our plugin? In addition to providing feedback, reviews can help other users to know who we are and what our plugin does.
Cheers!!!
Hello again,
other one issue is there.
If customer has enough abount in his waller, and he did checkout, order status was set to payd, what is ok, but total amount has not been increase
(
WC_Order Object
(
[status_transition:protected] =>
[data:protected] => Array
(
[parent_id] => 0
[status] => payd
[currency] => CZK
[total] => 452.40
....
)
When customer processed payment from wallet as partial payment, that total was increased.
-
This reply was modified 8 years ago by
minovec.