@login_required
@enforce_shopping_cart_enabled
def remove_item(request):
 item_id = (request.GET.get('id') or request.POST.get('id') or '-1')
 items = OrderItem.objects.filter(id=item_id, status='cart').select_subclasses()
 if (not len(items)):
  log.exception(u'Cannot remove cart OrderItem id=%s. DoesNotExist or item is already purchased', item_id)
 else:
  item = items[0]
  if (item.user == request.user):
   Order.remove_cart_item_from_order(item, request.user)
   item.order.update_order_type()
 return HttpResponse('OK')

@ login_required @ enforce_shopping_cart_enabled def remove_item ( request ) : item_id = ( request . GET . get ( 'id' ) or request . POST . get ( 'id' ) or '-1' ) items = OrderItem . objects . filter ( id = item_id , status = 'cart' ) . select_subclasses ( ) if ( not len ( items ) ) : log . exception ( u'Cannot remove cart OrderItem id=%s. DoesNotExist or item is already purchased' , item_id ) else : item = items [ 0 ] if ( item . user == request . user ) : Order . remove_cart_item_from_order ( item , request . user ) item . order . update_order_type ( ) return HttpResponse ( 'OK' )
this will remove an item from the user cart and also delete the corresponding coupon codes redemption .