To preface, I am not 100% familiar with the code, but I found a potential fix, but its in an area that cant be overriden by users. While setting up my project, I ran into a problem with guest users adding to products to the basket. It turns out that the code for fetching the basket in AddProductView is creating a new basket instead of using a prexisting one, or the one that matches up with the session basket. My simple fix is in this method:
def post(self, request, *args, **kwargs): # pylint: disable=redefined-builtin
where one would change : basket = operations.get_basket(request) to basket = request.basket im worried that this will break other things, and you can also go into basket.operations and just return request.basket for unauthenticated users which seems to be safe but again I'm not 100% familiar with the code.
To preface, I am not 100% familiar with the code, but I found a potential fix, but its in an area that cant be overriden by users. While setting up my project, I ran into a problem with guest users adding to products to the basket. It turns out that the code for fetching the basket in AddProductView is creating a new basket instead of using a prexisting one, or the one that matches up with the session basket. My simple fix is in this method:
def post(self, request, *args, **kwargs): # pylint: disable=redefined-builtin
where one would change : basket = operations.get_basket(request) to basket = request.basket im worried that this will break other things, and you can also go into basket.operations and just return request.basket for unauthenticated users which seems to be safe but again I'm not 100% familiar with the code.