Undone by Commerce Shipping Rules

Is it just me or is it the case with Drupal that the things that seem like they ought to be really hard, end up being super easy, and that, conversely, things you figure will be a slam dunk end up taking a week to figure out?

Case in point: I just spent three days I will never get back setting up two simple shipping rates for the gench site. I had smugly budgeted about 15 minutes for this task. It’s shipping – not rocket science – right?

I did finally figure it out, but it turned out there was one major barrier to overcome: my innate stupidity.

All I needed to do was setup two shipping rates:

  • Domestic: first item = $3 and 50 cents for each additional item
  • International: first item = $11 and $3 for each additional item

I found some good free vimeo videos on this topic created by rfay and setup the two shipping services and corresponding rules.

Here’s the thing that kills me: in hind-sight, I realize I solved this problem at about 3 hours into working on it. But I am so mathematically illiterate that I got confused and convinced myself it wasn’t workable, when in fact, I just needed to tweak my base rates.

You see, I set up the base rates as $3 and $11 respectively, which seemed to make sense.

I setup the shipping rules to do a calculation that takes the quantity of items in the shopping cart and multiplies it by the per item shipping rate (50 cents for domestic and $3 for international).

But the result (of course!) is this scenario: you have 3 items in the cart and your shipping address is US (so the domestic rules are in play), so …

$3 [base rate] + 50 cents times 3 items = $4.50

The problem is it should only be $4.00 – we’re double-charging for the base item in the cart.

Now a sensible person would have realized at this point what I only realized at 6pm last night: I just needed to change my domestic base rate from $3 to $2.50 (and adjust the international base rate from $11 to $8).

But no – I had to totally over-think it: I tried adding all sorts of crazy conditions and actions to the rules, trying to pass variables and remove the extra item. I spent hours googling “the problem” and reading tangentially related blog postings. I dreamt about it two nights in a row. I fumed about it to my husband and friends. I questioned whether I’m kidding myself with this Drupalista bullshit. I doubted my sanity and the purpose of this joyless universe. I wept.

I should know by now that generally, if nobody else in cyberspace is asking the same question as you, you’re probably asking the wrong question!

When the solution hit me like a thunderbolt at around 6pm last evening, I was stunned by the simplicity of it and disgusted with my byzantine-caveman brain. In fairness to myself, I was a little ill the past few days. At least that’s what I’ll keep telling myself.

Screen Shot 2013-07-13 at 5.44.21 PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s