Skip to content

Commit

Permalink
update: hpos enabled check remove & $item_total less than 0
Browse files Browse the repository at this point in the history
  • Loading branch information
osmansufy committed Dec 19, 2024
1 parent 7531b43 commit 3758043
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions includes/Commission/Settings/OrderItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,13 @@ public function get(): Setting {
*/
$order_id = wc_get_order_id_by_order_item_id( $this->order_item_id );

if ( $order_id && OrderUtil::is_hpos_enabled() ) {
if ( $order_id ) {
$order = dokan()->order->get( $order_id );
$item_total = $order->get_meta( '_dokan_item_total' );
} else {
$item_total = get_post_meta( $order_id, '_dokan_item_total', true );
$item_total = floatval( $order->get_meta( '_dokan_item_total' ) );
}

$product_price = (float) wc_format_decimal( $this->product_price_to_calculate_commission );
if ( $order_id && $item_total ) {
if ( $order_id && $item_total > 0 ) {
$additional_flat = ( floatval( $additional_flat ) / $item_total ) * $product_price;
}

Expand Down

0 comments on commit 3758043

Please sign in to comment.