Skip to content

Commit ecdc8f8

Browse files
committed
Merge branch 'release/4.1.1'
2 parents 44f3fa6 + 20030a3 commit ecdc8f8

20 files changed

+190
-177
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### v4.1.1 ( Oct 09, 2025 ) ###
2+
- **update:** Added method to retrieve vendor earnings excluding admin subsidy.
3+
- **update:** Admin gateway fee calculation now checks an order-level meta value before using the previous fallback logic.
4+
15
### v4.1.0 ( Sep 30, 2025 ) ###
26
- **feat:** New React-based Admin Dashboard with enhanced metrics and rank boards.
37
- **update:** Migrated Pro Features page from Vue to React with enhanced UI.

assets/js/vue-admin.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dokan-class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class WeDevs_Dokan {
2525
*
2626
* @var string
2727
*/
28-
public $version = '4.1.0';
28+
public $version = '4.1.1';
2929

3030
/**
3131
* Instance of self

dokan.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
* Plugin Name: Dokan
44
* Plugin URI: https://dokan.co/wordpress/
55
* Description: An e-commerce marketplace plugin for WordPress. Powered by WooCommerce and weDevs.
6-
* Version: 4.1.0
6+
* Version: 4.1.1
77
* Author: Dokan Inc.
88
* Author URI: https://dokan.co/wordpress/
99
* Text Domain: dokan-lite
1010
* Requires Plugins: woocommerce
1111
* WC requires at least: 8.5.0
12-
* WC tested up to: 10.2.1
12+
* WC tested up to: 10.2.2
1313
* Domain Path: /languages/
1414
* License: GPL2
1515
*/

includes/Commission.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,46 @@ public function get_earning_by_order( $order, $context = 'seller' ) {
245245
return apply_filters( 'dokan_get_earning_by_order', $earning_or_commission, $order, $context );
246246
}
247247

248+
/*
249+
* Get vendor earning sub-total
250+
*
251+
* @param int|WC_Order $order Order.
252+
*
253+
* @since DOKAN_SINCE
254+
*
255+
* @return float|int
256+
*/
257+
public function get_vendor_earning_subtotal_by_order( $order ) {
258+
if ( is_numeric( $order ) ) {
259+
$order = wc_get_order( $order );
260+
}
261+
262+
if ( ! $order ) {
263+
return new WP_Error( 'invalid_order', __( 'Order not found', 'dokan-lite' ), [ 'status' => 404 ] );
264+
}
265+
266+
if ( $order->get_meta( 'has_sub_order' ) ) {
267+
return null;
268+
}
269+
270+
try {
271+
$order_commission = dokan_get_container()->get( OrderCommission::class );
272+
$order_commission->set_order( $order );
273+
$order_commission->calculate();
274+
} catch ( \Exception $exception ) {
275+
return new WP_Error( 'commission_calculation_failed', __( 'Commission calculation failed', 'dokan-lite' ), [ 'status' => 500 ] );
276+
}
277+
$earning = $order_commission->get_vendor_earning_subtotal();
278+
279+
/**
280+
* Vendor earning without subsidy for a given order.
281+
*
282+
* @param float $earning Calculated earning (without subsidy).
283+
* @param WC_Order $order Order object.
284+
*/
285+
return apply_filters( 'dokan_get_vendor_earning_subtotal_by_order', $earning, $order );
286+
}
287+
248288
/**
249289
* Validate commission rate
250290
*

includes/Commission/OrderCommission.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,12 @@ public function get_admin_gateway_fee(): float {
237237
return floatval( $gateway_fee['fee'] );
238238
}
239239

240+
// if order has admin gateway fee, return it
241+
$admin_gateway_fee = $this->order->get_meta( 'dokan_admin_gateway_fee', true );
242+
if ( ! empty( $admin_gateway_fee ) ) {
243+
return floatval( $admin_gateway_fee );
244+
}
245+
240246
return 0;
241247
}
242248

@@ -296,6 +302,32 @@ public function get_vendor_earning(): float {
296302
return $this->get_vendor_net_earning() + $this->get_total_vendor_fees();
297303
}
298304

305+
/**
306+
* Vendor payout subtotal based on customer's actual payment.
307+
*
308+
* Returns the vendor’s payable subtotal (excludes admin subsidy) and caps it
309+
* to the amount actually paid by the customer (net of refunds) to avoid overpay during payment.
310+
*
311+
* Formula:
312+
* - admin < 0 → vendor_adj = vendor - abs(admin)
313+
* - admin ≥ 0 → vendor_adj = vendor
314+
*
315+
* @since DOKAN_SINCE
316+
*
317+
* @return float|int
318+
*/
319+
public function get_vendor_earning_subtotal(): float {
320+
321+
$admin_commission = $this->get_admin_commission();
322+
323+
// If admin commission is negative, it means admin has subsidized the vendor.
324+
if ( $admin_commission < 0 ) {
325+
return $this->get_vendor_earning() - abs( $admin_commission );
326+
}
327+
328+
return $this->get_vendor_earning();
329+
}
330+
299331
/**
300332
* Get dokan gateway fee.
301333
*

includes/Order/VendorBalanceUpdateHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function handle_order_edit( int $order_id, WC_Abstract_Order $order ) {
5151
$order_commission_calculator->set_should_adjust_refund( false );
5252
$order_commission_calculator->calculate();
5353

54-
$vendor_earning = $order_commission_calculator->get_vendor_earning();
54+
$vendor_earning = $order_commission_calculator->get_vendor_earning() + $order_commission_calculator->get_vendor_gateway_fee();
5555
} catch ( Exception $e ) {
5656
error_log( sprintf( 'Dokan: Order %d commission calculation failed. Error: %s', $order_id, $e->getMessage() ) );
5757
return;

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dokan",
3-
"version": "4.1.0",
3+
"version": "4.1.1",
44
"description": "A WordPress marketplace plugin",
55
"author": "Dokan Inc.",
66
"license": "GPL",

readme.txt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ Contributors: tareq1988, dokaninc, wedevs, nizamuddinbabu
33
Donate Link: https://dokan.co/wordpress/pricing/
44
Tags: WooCommerce multivendor marketplace, multi seller, multi vendor, multivendor, multivendor marketplace
55
Requires at least: 6.6
6-
Tested up to: 6.8.2
6+
Tested up to: 6.8.3
77
WC requires at least: 8.5.0
8-
WC tested up to: 10.2.1
8+
WC tested up to: 10.2.2
99
Requires PHP: 7.4
10-
Stable tag: 4.1.0
10+
Stable tag: 4.1.1
1111
License: GPLv2 or later
1212
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1313

@@ -349,6 +349,10 @@ A. Just install and activate the PRO version without deleting the free plugin. A
349349

350350
== Changelog ==
351351

352+
= v4.1.1 ( Oct 09, 2025 ) =
353+
- **update:** Added method to retrieve vendor earnings excluding admin subsidy.
354+
- **update:** Admin gateway fee calculation now checks an order-level meta value before using the previous fallback logic.
355+
352356
= v4.1.0 ( Sep 30, 2025 ) =
353357
- **feat:** New React-based Admin Dashboard with enhanced metrics and rank boards.
354358
- **update:** Migrated Pro Features page from Vue to React with enhanced UI.
@@ -366,9 +370,3 @@ A. Just install and activate the PRO version without deleting the free plugin. A
366370

367371
= v4.0.7 ( Sep 01, 2025 ) =
368372
- **fix:** Enhanced security controls for vendor account credentials management.
369-
370-
= v4.0.6 ( Aug 29, 2025 ) =
371-
- **update:** Added translation support for dashboard analytics report scripts to improve internationalization (i18n).
372-
- **fix:** Resolved an issue in the AdminNotice Vue component by applying the Mixin utility for improved functionality.
373-
- **fix:** Added async search in store category in vendor edit.
374-
- **fix:** Admin not receiving withdrawal request email notifications.

0 commit comments

Comments
 (0)