Besides calculating rates, Shipping Director can enforce all types of purchase rules. For example, If you want to enforce that if items are purchased from a specific category that there be at least n of them, then you want an Error expression that looks like "if there are Any items in category A and the Quantity of those items is less than n":
Order | Active | Type | Name | Expression | Rate Expression | Surcharge Expression | Name Expression | Description Expression |
10 |
| Reference | categories | ProductVariant.Product.ProductCategories |
|
|
|
|
20 |
| Reference | categoriesAnyA | [@categories].Any(Category.Name = "Category A") |
|
|
|
|
30 |
| ErrorExit | Not Enough Items from A | Items.Any([@categoriesAnyA]) and Items.Where([@categoriesAnyA]).Sum(Quantity) < 2 |
|
|
| "Not Enough Items from Category A" |
You would need to repeat lines 20 & 30 for each category
(The customer won't get warning until they get to shipping calc page, or estimate shipping)
NOTE: As of Shipping Director 1.08 for 2.80, you don't need line 10, and line 20's Reference should be: ProductVariant.Product.HasCategory("Category A")
NOTE: For Shipping Director for 3.10, you don't need line 10, and line 20's Reference should be: Product.HasCategory("Category A")