Skip to content

Commit

Permalink
Fix commission calculation when 100% coupon is applied.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aunshon committed Nov 20, 2024
1 parent 00bda24 commit dcb8376
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion includes/Commission.php
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,15 @@ public function get_commission( $args = [], $auto_save = false ) {
$category_id = $category_id ? $category_id : 0;
}

if ( ! empty( $product_id ) && empty( $total_amount ) ) {
/**
* If the $total_amount is empty and $order_item_id is empty then we will calculate the commission based on the product price.
* There is a case where the $total_amount is empty and $order_item_id is empty but the $product_id is not empty
* In this case, we will calculate the commission based on the product price.
* Also there is an issue when 100% coupon is applied see the below link for more details
*
* @see https://github.com/getdokan/dokan/pull/2440#issuecomment-2488159960
*/
if ( ! empty( $product_id ) && empty( $total_amount ) && empty( $order_item_id ) ) {
$product = dokan()->product->get( $product_id );

// If product price is empty the setting the price as 0
Expand Down

0 comments on commit dcb8376

Please sign in to comment.