Skip to main content

Drupal Commerce Free Shipping Rule

Published on

Free shipping offers are a huge request in Drupal Commerce. Here is how you can use one shipping calculation rule to provide free shipping without making new shipping services or modifying existing ones. Typically tutorials have you create a new "Free shipping" flat rate service that checks if the order is greater than XX and have your other services check if the order is less than XX. That's neat, but sucks if you or your client is just trying to offer a sweet deal for a month. The following is a rule for Drupal that runs at shipping calculation (shipping rule.) It checks if the line item is shipping, just in case, and then it also checks the orders total to be greater than $150, for example. It then alters the line item's cost to $0.00 - ensuring your customers are getting free shipping.

Having Drupal Commerce with free shipping doesn't have to be a headache. I hope this helps a few people out and saves the trouble of re-creating your shipping service structure.

Note: for data comparison we are using a raw currency amount, which means no decimal points. However when setting the line item's price we are setting a standard price amount.

I'm available for one-on-one consulting calls – click here to book a meeting with me 🗓️