How can I remove a single cart item using the catignign cart class?

I am using the cartignign class for my shopping cart project. I have a number of items on the cart. Now I have a cart id. Now, what I need to do is to remove a specific item from the cart, not all of the contents (Destroying cart).

$cartcontents = $this->cart->product_options($rowid); 

      

and send out all content. but doesn't work. Please help you who have an idea. Thank.

+3


source to share


4 answers


$data = array(
'rowid'   => '30ef30b64204a3088a26bc2e6ecf7602',
'qty'     => 0
);

$this->cart->update($data); 

      



use this

+11


source


Use the "removeCartItem" function in your controller to do this ...



function removeCartItem($rowid) {   
        $data = array(
            'rowid'   => $rowid,
            'qty'     => 0
        );

        $this->cart->update($data);
}

      

0


source


Create a delete button on the view page and add the line id with the link. After that create a function and pass the string id and put the count 0 and pass this array in the update function.

public function remove_cart_product($data) {
  $row_id=$data;
  $qty=0;
  $array=array('rowid' =>$row_id ,'qty'=>$qty );
  $this->cart->update($array);
  print_r($this->cart->contents());exit();
}

      

0


source


If the quantity is set to zero, the item will be removed from the cart.

$data = array(
           'rowid' => 'b99ccdf16028f015540f341130b6d8ec',
           'qty'   => 0
        );

$this->cart->update($data);

      

Here set QTY = 0, then it will be removed.

0


source







All Articles