From d4186c1a1e85d8e391ededfce5af4c3b1e9a2caa Mon Sep 17 00:00:00 2001 From: SHAMIM <111671483+Shamim-97@users.noreply.github.com> Date: Mon, 19 Jan 2026 12:45:41 +0600 Subject: [PATCH 1/3] Fix: exclude POS cash orders from vendor withdrawable balance --- includes/Dokan.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/includes/Dokan.php b/includes/Dokan.php index a4d0048f..73a8ea4c 100644 --- a/includes/Dokan.php +++ b/includes/Dokan.php @@ -26,6 +26,9 @@ public function __construct() { // If vendor created via REST API add_action( 'dokan_new_vendor', [ $this, 'after_create_vendor_via_rest' ], 15 ); + + // Exclude wepos_cash payments from vendor withdrawal balance + add_filter( 'dokan_order_should_exclude_from_vendor_balance', [ $this, 'exclude_wepos_cash_payment' ], 10, 5 ); } /** @@ -163,4 +166,29 @@ public function add_dokan_settings( $settings_fields ) { return $settings_fields; } + + /** + * Exclude wepos_cash payments from vendor withdrawal balance + * + * When a payment is made via wepos_cash method, exclude it from + * the vendor's withdrawal balance calculation. + * + * @since 1.3.3 + * + * @param bool $should_exclude Whether to exclude the payment. + * @param WC_Order $order Order object. + * @param int $order_id Order ID. + * @param string $new_status New order status. + * @param bool $exclude_cod Whether exclude COD option is enabled. + * + * @return bool True if payment should be excluded, false otherwise. + */ + public function exclude_wepos_cash_payment( $should_exclude, $order, $order_id, $new_status, $exclude_cod ) { + // Check if the payment method is wepos_cash + if ( $order->get_payment_method() === 'wepos_cash' ) { + return true; + } + + return $should_exclude; + } } From bd32cd6db8c0dec081891b3feeaf5cb3710365ec Mon Sep 17 00:00:00 2001 From: SHAMIM <111671483+Shamim-97@users.noreply.github.com> Date: Mon, 19 Jan 2026 13:03:21 +0600 Subject: [PATCH 2/3] Fix: exclude POS cash orders from vendor withdrawable balance --- includes/Dokan.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Dokan.php b/includes/Dokan.php index 73a8ea4c..25564f57 100644 --- a/includes/Dokan.php +++ b/includes/Dokan.php @@ -185,7 +185,7 @@ public function add_dokan_settings( $settings_fields ) { */ public function exclude_wepos_cash_payment( $should_exclude, $order, $order_id, $new_status, $exclude_cod ) { // Check if the payment method is wepos_cash - if ( $order->get_payment_method() === 'wepos_cash' ) { + if ( 'wepos_cash' === $order->get_payment_method() ) { return true; } From 7e2d35d5c9a2d1e9855301ab432dd85aaf97e3bc Mon Sep 17 00:00:00 2001 From: SHAMIM <111671483+Shamim-97@users.noreply.github.com> Date: Mon, 19 Jan 2026 18:02:33 +0600 Subject: [PATCH 3/3] fix: exclude wepos_cash payments from vendor balance adjustment on refund --- includes/Dokan.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/includes/Dokan.php b/includes/Dokan.php index 25564f57..052597a9 100644 --- a/includes/Dokan.php +++ b/includes/Dokan.php @@ -29,6 +29,7 @@ public function __construct() { // Exclude wepos_cash payments from vendor withdrawal balance add_filter( 'dokan_order_should_exclude_from_vendor_balance', [ $this, 'exclude_wepos_cash_payment' ], 10, 5 ); + add_filter( 'dokan_order_refund_should_exclude_from_vendor_balance', [ $this, 'prevent_wepos_cash_refund_deduction' ], 10, 6 ); } /** @@ -191,4 +192,29 @@ public function exclude_wepos_cash_payment( $should_exclude, $order, $order_id, return $should_exclude; } + + /** + * Prevent reducing refund amount from vendor balance for wepos_cash payments + * + * When a refund is processed for an order paid via wepos_cash method, + * prevent deducting the refund amount from the vendor's balance. + * + * @since 1.3.3 + * + * @param bool $should_exclude Whether to exclude from balance deduction. + * @param WC_Order $order Order object. + * @param int $order_id Order ID. + * @param string $new_status New order status. + * @param bool $exclude_cod Whether exclude COD option is enabled. + * + * @return bool True if refund should not reduce vendor balance, false otherwise. + */ + public function prevent_wepos_cash_refund_deduction( $should_exclude, $order, $order_id, $new_status, $exclude_cod, $refund_order ) { + // Check if the payment method is wepos_cash + if ( 'wepos_cash' === $order->get_payment_method() ) { + return true; + } + + return $should_exclude; + } }