Here's a very simple free shipping scenario with fixed rates. Customers in the "Free Shipping" role get an option for free shipping ($0). If not in that role, they see regular shipping. (The leading "!" is the NOT operator.) Everybody sees an option for "Fast Shipping".
(Update: 12/20/2021 - Customer.CustomerRoles won't work in 4.x and above. Use Customer.GetCustomerRoles() to get the full collection, or to check a specific role, use helper property Customer.IsInRole("role system name"). The below has been modified to use Customer.IsInRole() )
Order | Type | Name | Expression | Rate Expression |
10 | Option | Free Shipping | Customer.IsInRole("Free Shipping") | 0 |
20 | Option | Regular Shipping | !Customer.IsInRole("Free Shipping") | 5 |
30 | Option | Fast Shipping | true | 10 |
So, if the customer is in the Free Shipping role, then she sees
Select shipping method |
Fast Shipping ($10.00) |
And if she's not in that role she sees
Select shipping method |
Fast Shipping ($10.00) |
You can always add additional criteria. If there are a lot of criteria, then create a variable to make it easier to read and maintain. For example, let's also have additional criteria that the cart subtotal must be greater than $250
Order | Type | Name | Expression | Rate Expression |
5 | Boolean | HasFreeShipping | Customer.IsInRole("Free Shipping") and [$SubTotalWithDiscounts] > 250 |
|
10 | Option | Free Shipping | [HasFreeShipping] | 0 |
20 | Option | Regular Shipping | ![HasFreeShipping] | 5 |
30 | Option | Fast Shipping | true | 10 |