Yireo - Extensions, tutorials and blog for Magento and Joomla!

Blog Tags

MageBridge Standard

Free shipping for specific Magento products

Wednesday, 04 August 2010

The name itself is already a mouthful: The shopping cart price rules in Magento allow you to modify the price listed in the shopping cart, based on certain rules. These rules can get quiet complicated - this individual example shows you how weird it can get.

Allow free shipping for certain products only

The goal was simple: Setup a price rule that allows for free shipping of certain products. Configuring this rule was thought to be easy: Define a rule and make sure that the free shipping gets applied to a defined set of products.

free_shipping_1

But when testing this in the field, this actually was a lot more complicated: Shipping costs were not applied to each product individually, but to the total amount of products. So if a discounted product was added to the cart, free shipping should be applied. But if a second product - that was not in the list - was added to the cart, the free shipping should be removed.

Redefine the rule

So we had to redefine the rule: Only apply the free shipping, if the shopping cart is containing only products that are defined in the list. Yet differently defined: Do not apply the rule of free shipping at all, if the cart contains products that are not in the list.

free_shipping_2

In this case the Actions of the price rule were not exciting at all, but the Conditions contain the real magic: The rule is defined in such a way that it makes sure that all products in the shopping cart are products that have a SKU matching the list.

free_shipping_3

Note that the rule actually does not use Free shipping at all, but just gives a solid discount of 2.25. It just depends on the Shipping Method you're using whether this makes sense or not. Some shipping methods do not allow for free shipping, but a solid discount would bypass this problem.

Hope this example serves some purpose.

About Yireo

Yireo tries to help webdevelopers build successful Joomla! and Magento sites.

More about Yireo