@@ -117,7 +117,9 @@ public function get_dokan_order_data( $parent_order_id, $seller_id ) {
117117 'created ' => $ order ->created ,
118118 ];
119119
120- $ unit_commissin_rate_vendor = ( $ order ->commission_amount / $ order ->item_sub_total ) * 100 ;
120+ $ non_zero_item_sub_total_amount = empty ( $ order ->item_sub_total ) || $ order ->item_sub_total < 1 ? 1 : $ order ->item_sub_total ;
121+
122+ $ unit_commissin_rate_vendor = ( $ order ->commission_amount / $ non_zero_item_sub_total_amount ) * 100 ;
121123 $ unit_commissin_rate_admin = 100 - $ unit_commissin_rate_vendor ;
122124 $ new_admin_commissin = ( $ order ->item_sub_total * $ unit_commissin_rate_admin ) / 100 ;
123125
@@ -217,7 +219,7 @@ public function process_refund( $child_order, $seller_id, $from_suborder = true
217219 $ shipping_item_id = $ vendor_shipping [ $ vendor_id ]['shipping_item_id ' ];
218220 $ package_qty = absint ( $ vendor_shipping [ $ vendor_id ]['package_qty ' ] );
219221
220- ! $ package_qty ? $ package_qty = $ line_item ->get_quantity () : '' ;
222+ ! $ package_qty ? $ package_qty = $ line_item ->get_quantity () : 1 ;
221223
222224 $ shipping_item = new \WC_Order_Item_Shipping ( $ shipping_item_id );
223225 $ refund_shipping_tax = $ shipping_item ->get_taxes ();
@@ -410,12 +412,13 @@ public function split_parent_order_shipping( $applied_shipping_method, $order_id
410412
411413 $ applied_shipping_method = reset ( $ parent_order ->get_shipping_methods () );
412414 $ vendors = $ this ->get_seller_by_order ( $ parent_order ->get_id () );
415+ $ vendors_count = empty ( count ( $ vendors ) ) ? 1 : count ( $ vendors );
413416
414417 // Here we are dividing the shipping and shipping-tax amount of parent order into the vendors suborders.
415418 $ shipping_tax_amount = [
416- 'total ' => [ $ applied_shipping_method ->get_total_tax () / count ( $ vendors ) ],
419+ 'total ' => [ $ applied_shipping_method ->get_total_tax () / $ vendors_count ],
417420 ];
418- $ shipping_amount = $ applied_shipping_method ->get_total () / count ( $ vendors ) ;
421+ $ shipping_amount = $ applied_shipping_method ->get_total () / $ vendors_count ;
419422
420423 // Generating the shipping for vendor.
421424 $ item = new WC_Order_Item_Shipping ();
0 commit comments