Configuring Free Shipping For Orders More Than $150

This is tutorial #15 in the Drupal Commerce tutorial series. In the previous article, we offered a $6 discount on all orders worth more than $50.

In this article, we will go a step further and offer free shipping for orders worth more than $150. We will create a new flat rate and configure some rules to achieve this requirement.

This is how the final screen looks with the free shipping functionality enabled:

Let’s get started. Click “Store”:

Click “Configuration”:

Click “Add a flat rate service”:

In the new page, type in your new flat rate’s details. Note that I have provided the base rate as 0 since I intend to offer free shipping for orders greater than $150. Click “Save flat rate”.

Let’s now add a condition that will ensure this flat rate is applied to only orders above $150:

These are the fields you will have to enter values for:

  • Select the condition to add: Choose “Data comparison” from the dropdown.

  • DATA TO COMPARE: In the “Data selector” dropdown, you will have to specify the data type that will have to be compared.  Since we are trying to compare with the order total, “commerce-order:commerce-order-total:amount” has been iteratively selected and highlighted:

  • OPERATOR: Choose the value “is greater than” from the dropdown.

  • DATA VALUE: This is where you specify the figure you want to compare against. In my case, the figure is 150. You can’t provide a numerical value using the “Data selector” dropdown. You will have to click “Switch to the direct input mode”:

You can now enter the numerical value:

Click “Save” at the bottom of the page.

The flat rate and its condition have been saved.

Note that we configured 2 flat rates earlier – “Flat rate” (a $10 flat rate on all orders) and “Flat Rate For California” (a $15 flat rate on orders from California). We will have to create a new condition for both these flat rates so that they don’t apply for orders more than $150.

Let’s configure “Flat rate” first:

Click “configure component”.

Click “Add condition”:

Create a condition that’s exactly similar to the one we created above. Tick the box against “Negate” to ensure that the flat rate doesn’t apply to it:

The condition has been saved:

I am going to create a similar condition for “Flat Rate For California”. I have clicked “configure component” and provided the same values like I did in the earlier conditions:

The condition has been saved:

Let’s perform a checkout to test this free shipping functionality. I have filled my cart with an order worth more than $150:

I am providing a California shipping address. Earlier, a shipping rate of $15 was imposed on all California-based orders. Since we specified a new condition above, the $15 will no longer be applicable for orders above $150.

The shipping service has rightly invoked free shipping for the user:

And observe how the free shipping functionality is reflected in the final screen:

Next: Configuring Flat Shipping Rate Based On The Shopper's Shipping Address

Drupal Development

Sign up for our weekly newsletter

Add new comment