Skip to content

Commit 7eeddf5

Browse files
chore: Release version 4.2.8
Merge branch 'release/4.2.8'
2 parents d4aeb17 + 5f1481f commit 7eeddf5

File tree

15 files changed

+224
-79
lines changed

15 files changed

+224
-79
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
### v4.2.8 ( Jan 20, 2026 ) ###
2+
- **update:** Restore vendor revenue widget for vendor dashboard.
3+
- **update:** Improve query arguments on admin withdraw pages to support filtering options.
4+
- **fix:** Preserve order filters when paginating vendor dashboard orders.
5+
- **fix:** Prevent Dokan menu from appearing for users without permission.
6+
- **fix:** Resolve PHP deprecated warnings in the withdraw controller.
7+
18
### v4.2.7 ( Jan 14, 2026 ) ###
29
- **fix:** Allow Dokan stock restoration on WC Block Checkout.
310

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.2.7';
28+
public $version = '4.2.8';
2929

3030
/**
3131
* Instance of self

dokan.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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.2.7
6+
* Version: 4.2.8
77
* Author: Dokan Inc.
88
* Author URI: https://dokan.co/wordpress/
99
* Text Domain: dokan-lite

includes/Admin/Menu.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ public function __construct() {
2828
public function add_admin_menu() {
2929
global $submenu;
3030

31+
$capability = dokana_admin_menu_capability();
32+
if ( ! current_user_can( $capability ) ) {
33+
return;
34+
}
35+
3136
$menu_position = dokan_admin_menu_position();
32-
$capability = dokana_admin_menu_capability();
3337
$withdraw = dokan_get_withdraw_count();
3438
$withdraw_text = __( 'Withdraw', 'dokan-lite' );
3539
$slug = 'dokan';

includes/Analytics/Reports/DataStoreModifier.php

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,63 @@ class DataStoreModifier implements Hookable {
2020
*/
2121
public function register_hooks(): void {
2222
add_filter( 'woocommerce_data_stores', [ $this, 'modify_wc_products_stats_datastore' ], 20 );
23+
add_filter( 'woocommerce_rest_reports_column_types', [ $this, 'add_dokan_column_types' ], 10, 1 );
2324
}
2425

2526
/**
26-
* Customize the WooCommerce products stats datastore to override the $total_query and $interval_query properties.
27-
* This modification replaces the Automattic\WooCommerce\Admin\API\Reports\SqlQuery class with WeDevs\Dokan\Analytics\Reports\WcSqlQuery
28-
* to apply specific filters to queries.
29-
* The reason for this change is that the "get_sql_clause" method's second parameter defaults to "unfiltered," which blocks the filters we need
30-
* to add JOIN and WHERE clauses for the dokan_order_stats table.
27+
* Add Dokan column types to the WooCommerce reports.
3128
*
32-
* @see https://github.com/woocommerce/woocommerce/blob/9297409c5a705d1cd0ae65ec9b058271bd90851e/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php#L170
29+
* @since 4.2.8
3330
*
34-
* @param array $wc_stores An array of WooCommerce datastores.
35-
* @return array Modified array of WooCommerce datastores.
31+
* @param array $column_types
32+
* @return array
3633
*/
34+
public function add_dokan_column_types( $column_types ) {
35+
$dokan_column_types = [
36+
'avg_admin_commission' => 'floatval',
37+
'avg_vendor_earning' => 'floatval',
38+
'total_admin_commission' => 'floatval',
39+
'total_vendor_earning' => 'floatval',
40+
'total_vendor_gateway_fee' => 'floatval',
41+
'total_vendor_discount' => 'floatval',
42+
'total_admin_gateway_fee' => 'floatval',
43+
'total_admin_discount' => 'floatval',
44+
'total_admin_subsidy' => 'floatval',
45+
];
46+
47+
return array_merge( $column_types, $dokan_column_types );
48+
}
49+
50+
/**
51+
* Customize the WooCommerce products stats datastore to override the $total_query and $interval_query properties.
52+
* This modification replaces the Automattic\WooCommerce\Admin\API\Reports\SqlQuery class with WeDevs\Dokan\Analytics\Reports\WcSqlQuery
53+
* to apply specific filters to queries.
54+
* The reason for this change is that the "get_sql_clause" method's second parameter defaults to "unfiltered," which blocks the filters we need
55+
* to add JOIN and WHERE clauses for the dokan_order_stats table.
56+
*
57+
* @see https://github.com/woocommerce/woocommerce/blob/9297409c5a705d1cd0ae65ec9b058271bd90851e/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php#L170
58+
*
59+
* @param array $wc_stores An array of WooCommerce datastores.
60+
* @return array Modified array of WooCommerce datastores.
61+
*/
3762
public function modify_wc_products_stats_datastore( $wc_stores ) {
3863
if ( isset( $wc_stores['report-products-stats'] ) ) {
3964
$wc_stores['report-products-stats'] = \WeDevs\Dokan\Analytics\Reports\Products\Stats\WcDataStore::class;
4065
}
4166

42-
if ( isset( $wc_stores['report-taxes-stats'] ) ) {
67+
if ( isset( $wc_stores['report-taxes-stats'] ) ) {
4368
$wc_stores['report-taxes-stats'] = \WeDevs\Dokan\Analytics\Reports\Taxes\Stats\WcDataStore::class;
4469
}
4570

46-
if ( isset( $wc_stores['report-orders-stats'] ) ) {
71+
if ( isset( $wc_stores['report-orders-stats'] ) ) {
4772
$wc_stores['report-orders-stats'] = \WeDevs\Dokan\Analytics\Reports\Orders\Stats\WcDataStore::class;
4873
}
4974

50-
if ( isset( $wc_stores['report-coupons-stats'] ) ) {
75+
if ( isset( $wc_stores['report-coupons-stats'] ) ) {
5176
$wc_stores['report-coupons-stats'] = \WeDevs\Dokan\Analytics\Reports\Coupons\Stats\WcDataStore::class;
5277
}
5378

54-
if ( isset( $wc_stores['report-stock-stats'] ) ) {
79+
if ( isset( $wc_stores['report-stock-stats'] ) ) {
5580
$wc_stores['report-stock-stats'] = \WeDevs\Dokan\Analytics\Reports\Stock\Stats\WcDataStore::class;
5681
}
5782

includes/Analytics/VendorDashboardManager.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public function register_hooks(): void {
2020
add_filter( 'woocommerce_rest_report_sort_performance_indicators', [ $this, 'sort_performance_indicators' ] );
2121
// TODO: Need to review latest woocommerce release to resolve deprecated code usage.
2222
add_filter( 'woocommerce_rest_api_option_permissions', [ $this, 'add_option_check_permissions' ], 10, 2 );
23+
24+
add_filter( 'woocommerce_component_settings_preload_endpoints', array( $this, 'add_preload_endpoints' ), 20 );
2325
}
2426

2527
/**
@@ -149,4 +151,43 @@ public function sort_performance_indicators( $reports ) {
149151

150152
return $reports;
151153
}
154+
155+
/**
156+
* Load analytics revenue schema vendor dashboard.
157+
*
158+
* @since 4.2.8
159+
*
160+
* @see https://github.com/woocommerce/woocommerce/blob/8e3b0c45ad771d7fe53ee610f237f4803f1a63bb/plugins/woocommerce/src/Internal/Admin/Analytics.php#L113
161+
*
162+
* @param array $endpoints Array of preloaded endpoints.
163+
*
164+
* @return array
165+
*/
166+
public function add_preload_endpoints( array $endpoints ): array {
167+
$screen_id = ( function_exists( 'get_current_screen' ) && get_current_screen() ) ? get_current_screen()->id : '';
168+
169+
/**
170+
* Should load vendor analytics revenue schema.
171+
*
172+
* @since 4.2.8
173+
*
174+
* @param bool $load_schema Should load vendor analytics schema.
175+
* @param array $endpoints Array of preloaded endpoints.
176+
* @param string $screen_id Current screen ID.
177+
*/
178+
$load_analytics_schema = apply_filters(
179+
'dokan_analytics_reports_load_vendor_revenue_schema',
180+
'woocommerce_page_wc-admin' === $screen_id || dokan_is_seller_dashboard(),
181+
$endpoints,
182+
$screen_id
183+
);
184+
185+
// Only preload endpoints on wc-admin pages.
186+
if ( $load_analytics_schema ) {
187+
$endpoints['performanceIndicators'] = '/wc-analytics/reports/performance-indicators/allowed';
188+
$endpoints['leaderboards'] = '/wc-analytics/leaderboards/allowed';
189+
}
190+
191+
return $endpoints;
192+
}
152193
}

includes/Dashboard/Templates/Orders.php

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -325,23 +325,54 @@ public function add_css_class_to_body( $classes ) {
325325
private function add_pagination_info( $limit, $page, $order_count ) {
326326
$num_of_pages = ceil( $order_count / $limit );
327327
$base_url = dokan_get_navigation_url( 'orders' );
328-
$page_links = paginate_links(
329-
[
330-
'current' => $page,
328+
329+
$add_args = array();
330+
331+
if ( ! empty( $_GET['customer_id'] ) ) {
332+
$add_args['customer_id'] = absint( wp_unslash( $_GET['customer_id'] ) );
333+
}
334+
335+
if ( ! empty( $_GET['order_date_start'] ) ) {
336+
$add_args['order_date_start'] = sanitize_key( wp_unslash( $_GET['order_date_start'] ) );
337+
}
338+
339+
if ( ! empty( $_GET['order_date_end'] ) ) {
340+
$add_args['order_date_end'] = sanitize_key( wp_unslash( $_GET['order_date_end'] ) );
341+
}
342+
343+
if ( ! empty( $_GET['order_status'] ) ) {
344+
$add_args['order_status'] = sanitize_key( wp_unslash( $_GET['order_status'] ) );
345+
}
346+
347+
if ( ! empty( $_GET['search'] ) ) {
348+
$add_args['search'] = sanitize_text_field( wp_unslash( $_GET['search'] ) );
349+
}
350+
351+
if ( ! empty( $_GET['limit'] ) ) {
352+
$add_args['limit'] = absint( wp_unslash( $_GET['limit'] ) );
353+
}
354+
355+
$add_args['seller_order_filter_nonce'] = ! empty( $_GET['seller_order_filter_nonce'] )
356+
? sanitize_key( wp_unslash( $_GET['seller_order_filter_nonce'] ) )
357+
: wp_create_nonce( 'seller-order-filter-nonce' );
358+
359+
$page_links = paginate_links(
360+
array(
361+
'current' => max( 1, (int) $page ),
331362
'total' => $num_of_pages,
332-
'base' => $base_url . '%_%',
333-
'format' => '?pagenum=%#%&seller_order_filter_nonce=' . wp_create_nonce( 'seller-order-filter-nonce' ),
334-
'add_args' => false,
363+
'base' => trailingslashit( $base_url ) . '%_%',
364+
'format' => '?pagenum=%#%',
365+
'add_args' => $add_args,
335366
'type' => 'array',
336-
]
367+
)
337368
);
338369

339-
$args = [
340-
'num_of_pages' => $num_of_pages,
341-
'page_links' => $page_links,
342-
];
370+
$args = array(
371+
'num_of_pages' => $num_of_pages,
372+
'page_links' => $page_links,
373+
);
343374

344-
return $args;
375+
return $args;
345376
}
346377

347378
/**

includes/REST/WithdrawController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ public function get_items( $request ) {
380380
$exporter->set_items( $data );
381381
$exporter->set_page( $step );
382382
$exporter->set_limit( $args['limit'] );
383-
$exporter->set_total_rows( $statuses[ $args['status'] ] );
383+
// Determine total rows based on status
384+
$exporter->set_total_rows( $statuses[ $args['status'] ] ?? $withdraws->total );
384385
$exporter->generate_file();
385386

386387
$percent = $exporter->get_percent_complete();

includes/wc-template.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function dokan_product_seller_info( $item_data, $cart_item ) {
2020
$item_data[] = array(
2121
'name' => __( 'Vendor', 'dokan-lite' ),
2222
'value' => $vendor->get_shop_name(),
23+
'type' => 'vendor', // It is required to identify the vendor data type in REST API.
2324
);
2425

2526
return $item_data;

0 commit comments

Comments
 (0)