Skip to content

Commit

Permalink
fix: fixed weight issue only
Browse files Browse the repository at this point in the history
  • Loading branch information
devansh-webkul committed Jan 31, 2025
1 parent 15f9dc2 commit 2549cb8
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions packages/Webkul/Product/src/Type/Bundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,25 +267,20 @@ public function prepareForCart($data)
}

$cartProduct[0]['parent_id'] = $this->product->id;
$cartProduct[0]['quantity'] = $data['quantity'];
$cartProduct[0]['total_weight'] = $cartProduct[0]['weight'] * $data['quantity'];
$cartProduct[0]['base_total_weight'] = $cartProduct[0]['weight'] * $data['quantity'];

$products = array_merge($products, $cartProduct);

$products[0]['price'] += $cartProduct[0]['total'];
$products[0]['price_incl_tax'] += $cartProduct[0]['total'];
$products[0]['base_price'] += $cartProduct[0]['base_total'];
$products[0]['base_price_incl_tax'] += $cartProduct[0]['base_total'];
$products[0]['total'] += $cartProduct[0]['total'];
$products[0]['total_incl_tax'] += $cartProduct[0]['total'];
$products[0]['base_total'] += $cartProduct[0]['base_total'];
$products[0]['base_total_incl_tax'] += $cartProduct[0]['base_total'];
$products[0]['weight'] += ($cartProduct[0]['weight'] * $products[0]['quantity']);
$products[0]['total_weight'] += ($cartProduct[0]['total_weight'] * $products[0]['quantity']);
$products[0]['base_total_weight'] += ($cartProduct[0]['base_total_weight'] * $products[0]['quantity']);
$products[0]['weight'] += $cartProduct[0]['total_weight'];
}

$products[0]['total'] = $products[0]['total_incl_tax'] = $products[0]['total'] * $products[0]['quantity'];
$products[0]['base_total'] = $products[0]['base_total_incl_tax'] = $products[0]['base_total'] * $products[0]['quantity'];
$products[0]['total_weight'] = $products[0]['base_total_weight'] = $products[0]['weight'] * $products[0]['quantity'];

return $products;
}

Expand Down

0 comments on commit 2549cb8

Please sign in to comment.