cart item add weight problem
This commit is contained in:
parent
ce09d92880
commit
8438adb1eb
|
|
@ -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([
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue