Mini Tutorial: Create ‘Free Shipping’ & Message in the Cart

A ‘Free Shipping’ promotion is a great way to create an incentive for customers to buy better and more expensive items. Traditionally, we can see many sites adopting a free shipping message or banner informing the customer of the possibility of acquiring free shipping on their order. In the past, I have placed this message in the cart, but you really can place it anywhere.

The first thing that you will need to do is setup a free shipping rule in Promotions > Shopping Cart Price Rules in the backend of Magento. Click ‘Add New Rule’. From here, call the rule something self-explanatory like ‘Free Shipping’, and fill out the rest of the fields. Make sure it’s active, set to ‘No Coupon’, uses per customer is zero and the ‘from date’ is today. The important part here is to fill in the description with the free shipping amount.

If I had the free shipping rule apply after a customer spent $60, I would fill out “60” here. (Without the quotations.) Under the ‘Conditions’ tab, create a new condition that reads “Subtotal equals or greater ***” where *** is the free shipping amount. Under the ‘Actions’ tab, all we need to change is ‘Apply to Shipping Amount’ to yes and ‘Free Shipping’ to either “For Shipment with Matching Items” or “For matching items only”.

If you have any other store views or translations, it’s worth filling out the ‘Labels’ tab as well. Remember to navigate to System > Configuration > Shipping Methods to edit the shipping method you’re using to include a free shipping rate. For more information on the creation of the price rule and editing the shipping method, you can reference this well written article. Once you’ve returned to the Shopping Cart Price Rules menu, record the ID number of the rule that you’ve just created.

If you haven’t already, copy the template/checkout/cart.phtml file to your theme. Add this section before the form tag begins (where *** is your shopping cart price rule ID number):

http://hastebin.com/yudefafuta.xml

**Note: In the above code, we’re getting the description of the sales rule with the amount. If you change the price rule, remember to update this amount to the new condition. If you would like to place this message other places on your site, you may need to get the quote object a different way, like so:

Mage::getModel(‘checkout/cart’)->getQuote();

Feel free to change the messages regarding free shipping in the code as well!