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
GlobalCartPolicy has three properties:
Defines the maximum allowed value of the cart per currency. Note that the class defines default values of USD 1000 and CAD 1250. The
InitializeEnvironmentCartsPolicySetsBlockresets this to USD 1000 and CAD 500.
Maximum number of line items in a cart. By default this is set to 100. The
InitializeEnvironmentCartsPolicySetsBlockresets this to 10.
Configuration option to show the cart after the customer added a product. I'm not sure if this is used by SXA for instance.
This policy contains naming for 4 known adjustment types:
- 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 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 quantity for a line (default
Maximum quantity for a line (default:
Allow decimals (default:
RollupCartLinesPolicy only has one property:
Defines whether cart lines are rolled up. The default is
If set to
trueif 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
falseif 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
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.