cart item add weight problem

This commit is contained in:
merdan 2024-02-19 17:49:56 +05:00
parent ce09d92880
commit 8438adb1eb
1 changed files with 7 additions and 3 deletions

View File

@ -39,12 +39,16 @@ class Carts extends CartController
public function add(Request $request, WishlistRepository $wishlistRepository, int $productId) public function add(Request $request, WishlistRepository $wishlistRepository, int $productId)
{ {
$customer = $request->user(); $customer = $request->user();
try { try {
Event::dispatch('checkout.cart.item.add.before', $productId); Event::dispatch('checkout.cart.item.add.before', $productId);
$result = Cart::addProduct($productId, $request->all()); $data = $request->all();
if(!isset($data['weight']) || empty($data['weight']) ) {
$data['weight'] = 0;
}
$result = Cart::addProduct($productId, $data);
if (is_array($result) && isset($result['warning'])) { if (is_array($result) && isset($result['warning'])) {
return response([ return response([