# -*- coding: utf-8 -*-
""" Price modifiers are the cart's counterpart to backends. It allows to implement Taxes and rebates / bulk prices in an elegant manner:
Everytime the cart is refreshed (via it's update() method), the cart will call all subclasses of this registered with their full path in the settings.SHOP_CART_MODIFIERS setting. """
""" This will be called for every line item in the Cart: Line items typically contain: product, unit_price, quantity...
Subtotal for every line (unit price * quantity) is already computed, but the line total is 0, and is expected to be calculated in the Cart's update() method """
""" This will be called once per Cart, after every line item was treated The subtotal for the cart is already known, but the Total is 0. Like for the line items, total is expected to be calculated in the cart's update() method.
Line items should be complete by now, so all of their fields are accessible """
""" Add an extra price field on cart_item.extra_price_fields:
This allows to modify the price easily, simply add a {'Label':Decimal(difference)} entry to it.
A tax modifier would do something like this: >>> cart_item.extra_price_fields.update({'taxes': Decimal(9)})
And a rebate modifier would do something along the lines of: >>> cart_item.extra_price_fields.update({'rebate': Decimal(-9)})
More examples can be found in shop.cart.modifiers.*
"""
""" Add a field on cart.extra_price_fields:
In a similar fashion, this allows to easily add price modifications to the general Cart object,
>>> cart.extra_price_fields.update({'Taxes total': 19.00}) """ |