django - 如何对篮子线申请折扣?
问题描述
Django-oscar 的新手,无法在官方文档上获得答案我正在尝试添加折扣我试过这个:
line, created = self.request.basket.add_product(product=product, quantity=serializer.validated_data['quantity'], options=options)
line.discount(discount_value=20, affected_quantity=1)
line.save()
并且当我尝试打印basket.total_excl_tax_excl_discounts
或basket.total_excl_tax
总是得到相同的结果时(无论我添加了多少折扣,这都是购物篮的总数)
我错过了什么?