You finished doing your taxes in April so it's time to have some fun! And what better way to have fun than dissecting Sitecore Commerce policies.

So in May I'm going to (sort of) document all the available default policies in Sitecore Commerce. Sometimes this involves some guessing so if you have a better understanding of a policy, let me know so I can adjust this post.

We'll start with the policies defined in Sitecore.Commerce.Plugin.Carts

GlobalCartPolicy

GlobalCartPolicy has three properties:

  • MaximumCartValue (MultiCurrency)
    Defines the maximum allowed value of the cart per currency. Note that the class defines default values of USD 1000 and CAD 1250. The InitializeEnvironmentCartsPolicySetsBlock resets this to USD 1000 and CAD 500.
  • MaximumLineItems (int)
    Maximum number of line items in a cart. By default this is set to 100. The InitializeEnvironmentCartsPolicySetsBlock resets this to 10.
  • ShowCartAfterAdd (bool)
    Configuration option to show the cart after the customer added a product. I'm not sure if this is used by SXA for instance.

KnownCartAdjustmentTypesPolicy

This policy contains naming for 4 known adjustment types:

  • Fee
  • Discount
  • Tax
  • Fulfillment (Spelling error is intentional)

By default the names of the properties are used. This policy is used when adding an adjustment to a cart to indicate the type of adjustment.

LineQuantityPolicy

The LineQuantityPolicy is used to defines minimum and maximum quantities for a line item and whether you allow decimals as a quantity. Why would you want decimals? Maybe you want to sell 1.5 liters of milk or 3.4 meters of carpet.

  • Minimum (Decimal)
    Minimum quantity for a line (default 0)
  • Maximum (Decimal)
    Maximum quantity for a line (default: 100)
  • AllowDecimal (bool)
    Allow decimals (default: false)

RollupCartLinesPolicy

The RollupCartLinesPolicy only has one property:

  • Rollup (bool)
    Defines whether cart lines are rolled up. The default is true.
    If set to true if you add a line to the cart containing a sellable item that is already in the cart, the quantity of the new line is added to the existing line. This means the total quantity of the cart increases but the number of lines in the cart stays the same.
    If set to false if you add a line to the cart containing a sellable item that is already in the cart, the line is added to the cart as a separate line.

These are the first four policies of Policy month, next time we'll have a look at Sitecore.Commerce.Plugin.Orders.

And if you're wondering how I know which policies are in each plugin, have a look at Plumber, the configuration viewer for Sitecore Commerce.