ShippingDiscountAdjust

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Use the ShippingDiscountAdjust pipeline component to apply either currency value or percentage value shipping discounts to an order. Shipping discounts apply to an order at the cumulative level, as apposed to an item-specific level, which makes shipping discounts similar to an order-level discount.

Intended use: Order Processing pipeline, Shipping stage.

Configuration Values

None.

Values Read

The ShippingDiscountAdjust pipeline component reads the following values from the indicated dictionaries.

Key

Dictionary

Description

_currency_decimal_places

Order

Optional (if not set, the _currency_lcidkey must be set, and the number of currency decimal places will be the default for that locale). Describes the number of digits of precision (after the decimal point) for which to round certain intermediate results, and to round to when writing currency values into the OrderForm.

Type: Integer (VT_I4)

_currency_lcid

Order

Optional (required only if the _currency_decimal_places key is not set, otherwise it is ignored). Describes a locale (LCID) to use to retrieve the number of currency decimal places.

Type: Integer (VT_I4)

_cy_shipping_total

Order

Required. The total shipping charges for the entire order as computed by a pipeline component such as ShippingMethodRouter.

Type: Currency (VT_CY)

ms960051.alert_note(en-US,CS.70).gifNote:
If the shipments key is set, this value will not be used on input, however, it will be modified on output.

_orderlevel_discounts_detail

Order

Optional (if this key does not exist in the OrderForm, or if the shipping_discount key of this dictionary does not exist, the _cy_shipping_discounts_total value is set to zero, and no other action is taken). A dictionary that maps special offer types to a list of order level discounts that applies for that special offer type. The SimpleList object under the shipping_discount special offer type key is used.

Each element is a dictionary. The exact format of the dictionary depends on whether the element represents a combination of percentage-off discounts of the same priority, or a single discount.

The following are the dictionary entries if the element represents a single discount:

  • discount_id: Integer (VT_I4)

  • discount_timestamp: Last_modified timestamp of the discount (VT_DATE)

  • discount_name: Discount name (VT_BSTR)

The following are the dictionary entries if the element represents a combined percentage-off discount:

  • discounts_combined: SimpleList object that describes each of the discounts that were combined. Each element in this list is a Dictionary with the following keys:

    • discount_id: Integer (VT_I4)

    • cy_discount_percentage: Value (VT_CY)

    • discount_timestamp: Llast_modified tiemestamp of the discount (VT_DATE)

    • discount_name: Discount name (VT_BSTR)

The following are the dictionary entries that exist in both cases:

  • discount_priority: Priority (rank)

  • discount_type: 1=Currency; 2=Percentage (VT_I4)

  • cy_discount_value: Currency or Percentage value (VT_CY). If the element represents a combined percentage-off discount, this is the total percentage.

The order the elements appear in the list is significant, because it is the order that the OrderDiscount pipeline component has determined they should be applied.

Type: Currency (VT_CY)

ms960051.alert_note(en-US,CS.70).gifNote:
This is the list that is used by the OrderDiscount pipeline component to specify to other pipeline components the complete list of order level discounts that should be applied to the basket.

shipments._cy_shipping_total

Order

Required. The shipping totals for each shipment, as computed by a component such as ShippingMethodRouter.

Type: Currency (VT_CY)

Values Written

The ShippingDiscountAdjust pipeline component writes the following values to the Order dictionary.

Key

Description

_cy_shipping_total

Not always written (modified only if one or more shipping discounts apply). The total shipping charges for the order with the discounts (if any) applied.

Type: Currency (VT_CY)

_cy_shipping_discounts_total

Always written (if no shipping discounts apply, this is set to zero). Sum of all shipping discounts applied to the order.

Type: Currency (VT_CY)

_shipping_discounts_applied

Not always written (only written when no shipments list exists in the OrderForm, and one or more shipping discounts apply). A SimpleList of dictionaries where each dictionary contains information about a shipping discount that was applied to this shipment. The order of the list is significant and represents the order in which the discounts were applied to the shipment.

The dictionary contains the following elements for each discount:

  • discount_id: Campaign item ID (VT_I4)

  • discount_priority: Discount priority (rank) (VT_I4)

  • discount_timestamp: Last-modified timestamp of the discount (VT_DATE)

  • cy_discount_amount: How much was actually taken off the item (VT_CY)

  • discount_type: 1=Currency Value; 2=Percentage (VT_I4)

  • cy_discount_value: Currency value or percentage value (VT_CY)\

  • discount_name: Discount name (VT_BSTR)

Type: Dictionary (VT_DISPATCH)

shipments._cy_shipping_total

Not always written (modified only if one or more shipping discounts apply). The total amount of shipping charges for the shipment after shipping discounts have been applied.

Type: Currency (VT_CY)

shipments._cy_shipping_discounts_subtotal

Not always written (only written if one or more shipping discounts apply to the shipment). The sum of all shipping discounts applied to this shipment.

Type: Currency (VT_CY)

shipments._shipping_discounts_applied

Not always written (only written if one or more shipping discounts apply to the shipment). A SimpeList of dictionaries where each dictionary contains information about a shipping discount that was applied to this shipment. The order of the list is significant and represents the order in which the discounts were applied to the shipment.

The dictionary contains the following elements for each discount:

  • discount_id: Campaign item ID (VT_I4)

  • discount_priority: Discount priority (rank) (VT_I4)

  • discount_timestamp: Last-modified timestamp of the discount (VT_DATE)

  • cy_discount_amount: How much was actually taken off the item (VT_CY)

  • discount_type: 1=Currency Value; 2=Percentage (VT_I4)

  • cy_discount_value: Currency value or percentage value (VT_CY)\

  • discount_name: Discount name (VT_BSTR)

Type: Dictionary (VT_DISPATCH)

Remarks

You can use the ShippingDiscountAdjust pipeline component to provide free shipping by writing zero (0) for the _cy_shipping_total key.

See Also

Other Resources

OrderLevelDiscountApply

ShippingMethodRouter

StepwiseShipping

Pipeline Component Reference