• Hi,

    I am using wp-ecommerce plugins and i ann trying to delete product from cart and this is not deleting.

    Here is my code and website detail:
    Url:http://108.166.87.229/AAB/

    cart url:http://108.166.87.229/AAB/products-page/checkout/

    I am trying to bulk delete from this plugins using cart item key but its not delete particulur item.

    Here is code that i am using:

    function remove_item($key) {
    if(isset($this->cart_items[$key])) {
    $cart_item =& $this->cart_items[$key];
    $cart_item->update_item(0);
    unset($this->cart_items[$key]);
    $this->cart_items = array_values($this->cart_items);
    $this->cart_item_count = count($this->cart_items);
    $this->current_cart_item = -1;
    do_action( ‘wpsc_remove_item’, $key, $this );

    $this->clear_cache();
    return true;
    } else {
    $this->clear_cache();
    return false;
    }

    }

    ////////////

    function removeProductItem()
    {
    global $wpsc_cart, $wpdb;
    $purchaseLog = $wpsc_cart->log_id;

    $allProductID = $_REQUEST[‘removeListPID’];

    $arrProductID = explode(‘,’,$allProductID);
    $allKey = $_REQUEST[‘removeListID’];

    $arrCartKey = explode(‘,’,$allKey);
    $arrF = array();

    foreach($wpsc_cart->cart_items as $pKey=>$cartKey)
    {
    if(in_array($cartKey->product_id,$arrProductID)){

    if($wpsc_cart->remove_item($pKey))
    {

    }
    else {

    $arrF[] = $pKey;
    }
    //echo $pKey.”
    ums”;
    }
    }
    if(count($arrF)>0){
    foreach($arrF as $fval)
    {

    $wpsc_cart->remove_item($pKey);

    }
    }
    $wpsc_cart->clear_cache();

    //$wpsc_cart->remove_item(0);
    header(‘Location:’.site_url().’/products-page/checkout’);
    exit;

    }

    https://wordpress.org/plugins/wp-e-commerce/

  • The topic ‘WP-ecommerce :Item are not deleting from cart.’ is closed to new replies.