How to remove the single cart item using codeigniter cart class?

萝らか妹 提交于 2019-12-04 13:55:43
$data = array(
'rowid'   => '30ef30b64204a3088a26bc2e6ecf7602',
'qty'     => 0
);

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

use this

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

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

        $this->cart->update($data);
}
Gaurav Marvaha Hapur

Create a remove button at view page and add row id with link. After that create a function and pass row id and put quantity 0 and pass that array in 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();
}
jithin k p

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!