Partial payments – no debit in wallet
-
Hello sir,
I have a strange issue. When customer chose partial payment in the checkout page, and then the customer choose other payment method (COD, bank transfer), the amount is not debited from customer wallet imediatelly, but I can see Via Wallet fee in the order details.
When the customer chose credit card payment (status processing) the partial amount has been debited ok.
I am using custom order statuses, and for example when customer chose COD, the first status of the order is set to pending and after that set to custom_COD_status automatically. For example bank transfer, the status of the order is set to pending and after that is set to custom_WAIT_status.
I have following code in functions.php
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); } } }but this code is not working. I don’t have ‘_via_wallet_payment’ meta in the order.
How can I fix this issue please?
Thanks a lot for any help.
Regards Milan from Czech Republic
The topic ‘Partial payments – no debit in wallet’ is closed to new replies.