Remove specific product from cart Not Working

  • This post is deleted!

  • Hi @RehamALraee,

    Can you share with me more steps and info so that I can further investigate?

  • Facing same issue.
    API call
    No product remove
    Solution that I try:

    1. I open file 'packages/Webkul/API/Http/routes.php'.
      In this file route is related to this: cart/remove-item/{id}', '[email protected]'
    2. I open destroyItem function in CartController class.
    public function destroyItem($id)
            $id = request('id');
            Event::dispatch('checkout.cart.item.delete.before', $id);
            Event::dispatch('checkout.cart.item.delete.after', $id);
            $cart = Cart::getCart();
            return response()->json([
                'message' => __('shop::app.checkout.cart.item.success-remove'),
                'data'    => $cart ? new CartResource($cart) : null,
    • removeItem() in 'packages/Webkul/Checkout/src/Cart.php'
        public function removeItem($itemId)
            Event::dispatch('checkout.cart.delete.before', $itemId);
            if (! $cart = $this->getCart()) {
                return false;
            if ($cartItem = $cart->items()->find($itemId)) {
                if ($cart->items()->get()->count() == 0) {
                    if (session()->has('cart')) {
                Event::dispatch('checkout.cart.delete.after', $itemId);
                return true;

    Problem: It is not very much intuitive to understand how this code work.

    • 'Cart::removeItem($id);' this line may not work properly.

    • there is no effect on 'quantity' of item even if I remove one . It should be decrease by one.

    • I can't able to find which table is use to save quantity of item in database.

    • the level of abstraction is to much high and unclear for simple work like removing item form cart,and it is quite complicated to understand how it works even if I have more then year of experince on laravel and php and I am using Bagisto for a long time.

    • Response of api but no item remove cart

        "message": "Item was removed successfully from the cart.",
        "data": {
            "items": [
                    "quantity": "3",
                    "product": {
                        "id": 7,
                        "sku": "4",
                        "type": "simple",
                        "name": "Sugar Control RNR15048 Rice",
                        "url_key": "sugar-control-rnr15048-rice",
                        "price": "15.0000",
                        "formated_price": "₹15.00",
                        "short_description": "<p>Sugar Control RNR15048 Rice</p>",
                        "description": "<p>Sugar Control RNR15048 Rice</p>",
                        "images": [
                                "id": 27,
                                "path": "product/7/yS6rwYkuafpi2AQMY487hKfOf23yDylj4NvZgQ1m.jpg",
                                "url": "",
                                "original_image_url": "",
                                "small_image_url": "",
                                "medium_image_url": "",
                                "large_image_url": ""
                        "videos": [],
                        "base_image": {
                            "small_image_url": "",
                            "medium_image_url": "",
                            "large_image_url": "",
                            "original_image_url": ""
                        "created_at": "2021-07-07T11:39:50.000000Z",
                        "updated_at": "2021-07-07T11:39:50.000000Z",
                        "reviews": {
                            "total": 0,
                            "total_rating": 0,
                            "average_rating": 0,
                            "percentage": []
                        "in_stock": true,
                        "is_saved": false,
                        "is_wishlisted": true,
                        "is_item_in_cart": true,
                        "show_quantity_changer": true,
                        "special_price": "15.0000",
                        "formated_special_price": "₹15.00",
                        "regular_price": "20.0000",
                        "formated_regular_price": "₹20.00"
            "created_at": "2022-05-31T05:32:21.000000Z",
            "updated_at": "2022-05-31T06:43:28.000000Z"
    • there is 3 quantity and it does not change.
      Can anyone please help. I urgently need help. I you need more detail then contact.

Log in to reply