Using Calculation Rules to Add Per-Item Shipping in Commerce Shipping (screencast)

In this screencast I demonstrate how to do shipping charges per item in the cart. It shows using a loop in Rules and how to do something new and different with shipping.

We want to add $5.00 to the shipping charge for every item they have. So if the quantity is 5 for some line item, we'll add $25 to the shipping charge.

The technique is this:

  • Add a shipping service. We're using a flat rate service with a $10 base rate.
  • Add a new "Calculation rule" for that service.
  • Add an action loop that loops through the line items in the order.
  • Add an action "Calculate a value" and multiply the quantity times 500 ($5.00) and put the result in a named variable.
  • Add an action "Add an amount to the unit price" that adds the named variable to the unit price of the shipping line item.
Posted November 28, 2011

Comments

Submitted by Sahaj (not verified) on

First, thanks for this screencast, which is very helpful.
I have follow your steps and have the solution working, but my issue is that I have 2 different flat rates and would like that the rule apply to the appropriate flat rate only.
With your example it apply to both flat rates.
Notice that maybe my full approach is wrong. Actually, my aim is to have 2 shipping rates (economy and priority) with a price per-items value.
Thanks for help.

Submitted by Juan (not verified) on

Hello Randy,

Great video, as the whole serie.

I am trying to create two different Shipping services, one local and other international. I guess the only to separate local from international is indicating the shipping country to be one (say US) or NOT one (negate US).

It's not working fine at this point. I just followed your video, but maybe I am doing something wrong.

Is it possible to create lists of Contry Regions, like Latin America or Europe, and insert all the countries of that region in the list? It is easier than compare the countries one by one..

I appreciate your comments and, again, thanks a lot for the series.

juan

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <br>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.