Discounts¶
ShoppingCart supports CiviDiscount.
Usage¶
You need to create a form that allows you to enter a discount code.
To do this create a FormBuilder submission form with "CartItem".
Now find the field "Discount Code" and add it. On submission it will be verified and a discount (ie. negative) item added to the cart.
Important: If you add the discount_code to a form that adds other items to the cart (eg. Membership) then you MUST put the CartItem entity as the last entity in the form otherwise the discount will not be applied. Eg. see:

Custom Discounts¶
You can also implement the post hook and add/edit/delete CartItems. Just be careful that you don't create infinite loops!