public function removeItem($itemIndex) { if (isset($this->_items[$itemIndex])) { $product = $this->_items[$itemIndex]->getProduct(); $this->_items[$itemIndex]->detachAllForms(); if (count($this->_items) <= 1) { Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] about to remove user price from session: userPrice_" . $product->id . '_' . $this->_items[$itemIndex]->getFirstFormEntryId()); Cart66Session::drop('userPrice_' . $product->id . '_' . $this->_items[$itemIndex]->getFirstFormEntryId(), true); $this->_items[$itemIndex]->detachAllForms(); $this->_items = array(); Cart66Session::drop('Cart66Tax', true); Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Reset the cart items array"); } else { Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] about to remove user price from session: userPrice_" . $product->id . '_' . $this->_items[$itemIndex]->getFirstFormEntryId()); Cart66Session::drop('userPrice_' . $product->id . '_' . $this->_items[$itemIndex]->getFirstFormEntryId(), true); $this->_items[$itemIndex]->detachAllForms(); unset($this->_items[$itemIndex]); Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Did not reset the cart items array because the cart contains more than just a membership item"); } $this->_setPromoFromPost(); Cart66Session::touch(); do_action('cart66_after_remove_item', $this, $product); } }