Videos

Free Shipping Based on Order Value or User Role

Date Published: 
11/25/2011
Duration: 
24:33

This screencast shows some more advanced rules-based configuration of [Commerce Shipping](http://drupal.org/project/commerce_shipping). Note again that we're using the 7.x-2.x branch (currently a dev release) of Commerce Shipping, and the new [Commerce Flat Rate](http://drupal.org/project/commerce_flat_rate) module.

I'll demonstrate how to create two different "flat rate" shipping services, one with shipping for $10 and one called "free shipping" which costs $0. The real reason for breaking these out is just to make it really obvious to the user what a great deal they're getting.

We'll offer free shipping two different ways: First, based on order value, and second, based on the role of the user (We might have a free shipping, or "premier" role like Amazon's "Prime".).

To do free shipping based on order value:

* Create a free shipping and a flat-rate shipping service, with values of $0 and $10.
* In the component for the free shipping service, add a data comparison on the order total, checking to see if it's over 9999 ($99.99)
* In the component for the flat rate shipping, add a data comparison that is the opposite.

To do free shipping based on user role:

* Create a role called "Free Shipping".
* In the component for the free shipping service add a condition "user has role", on the logged in user, "Free Shipping"
* In the component or the flat rate service, add the negative of that same condition.

And the screencast shows how to do both together.

The third portion of the screencast shows how to do shipping based on order value and making absolutely sure that the order value does not include the shipping cost that has already been calculated. Watch it if you've totally mastered the first two and you're interested. Otherwise just skip it :-)

Comments

sakisplus on December 3, 2013

Hello,

I don't know if that I'm going to describe below is the right way but it works fine for me.

Another way do delete shipping line items before apply the new ones is to add an action "Delete all shipping line items from an order" to the gereral rule "Collect rates: Flat rate", before the default action "Collect rates for a shipping method".

Many thanks to all of you, for your excelent work with Drupal Commerce.