I'm not getting a return on the color and size, only the product name is coming.
And yes my request.POST['color'] and request.POST['size'] are receiving the values, but in the form of names and not in id.
def add_to_cart(request, product_id):
product = Product.objects.get(id=product_id)
variation_list = []
if request.method == "POST":
color = request.POST['color']
size = request.POST['size']
try:
variation = Variation.objects.get(product=product, color__name__exact=color, size__name__exact=size)
variation_list.append(variation)
except:
pass
return HttpResponse(variation_list)