Skip to content

Commit 7cdf39b

Browse files
committed
try to retrieve commission meta using dokan_commission_meta key
1 parent c677a65 commit 7cdf39b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

includes/Order/Hooks.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,21 @@ public function __construct() {
5959
add_filter( 'woocommerce_can_reduce_order_stock', [ $this, 'prevent_stock_reduction_for_parent_order' ], 10, 2 );
6060

6161
add_action( 'woocommerce_reduce_order_item_stock', [ $this, 'sync_parent_order_item_stock' ], 10, 3 );
62+
63+
// if _dokan_commission_meta does not exists, search for dokan_commission_meta
64+
add_filter( 'woocommerce_order_item_get__dokan_commission_meta', [ $this, 'get_dokan_commission_meta' ], 10, 2 );
65+
}
66+
67+
/**
68+
* Retrieve commission meta using old dokan_commission_meta.
69+
*
70+
* @return mixed
71+
*/
72+
public function get_dokan_commission_meta( $value, $item ) {
73+
if( empty( $value ) ) {
74+
return $item->get_meta( 'dokan_commission_meta', true );
75+
}
76+
return $value;
6277
}
6378

6479
/**

0 commit comments

Comments
 (0)