Discount codes

A discount is a price incentive offered to customers to promote a purchase. A discount code is a calculation code whose calculation usage is "discount." It is used to calculate order item adjustments. Each row in the CALCODE table represents a CalculationCode. CalculationCodes represent ways of determining monetary amounts associated with OrderItems. They are used to calculate discounts, shipping charges, sales tax, and shipping tax. A CalculationCode attachment can be limited to specific TradingAgreements.

Two dimensions are involved in attaching a discount code to a product or a group of products. First, the discount can be attached to one or more catalog entries, and catalog groups. Attaching a calculation code to a catalog group has the same effect as attaching it to all the catalog entries directly in the catalog group. 

Second, the order items are grouped for calculation in one of three ways: per trading agreement, per product, per offer, or per shipping address. This is specified by the groupBy attribute. A separate calculation is performed for each group of OrderItem objects. If no grouping is specified, then all the OrderItems attached to a particular CalculationCode object are used to perform a single calculation. The following outlines the attributes used to calculate different types of discounts:

Products may have more than one discount associated with them. Similarly, member groups may have more than one discount for which they are eligible. When more than one discount calculation code is applicable to an Order object, discount calculations are performed in ascending sequence of their CalculationCode object sequence attributes. This restricts a CalculationCode for use only by members of certain member groups as defined in the CALCODEMGP table. As with all calculation codes, multiple discount codes may be associated with each product, and discount codes can be restricted for use only by members of certain member groups.