Sunday 9 June 2013

Introduction to Commerce Shipping by Randy Fay


Introduction to Commerce Shipping from Randy Fay on Vimeo.
Finally Commerce_Shipping [module] is coming of age!

I want to give you a quick tour of how to do some things with commerce shipping.
What we're looking at today is this
So that's what we are going to work with. (and) [50" fifty seconds into the video]
What we are going to do is, first of all,
  • we are going to create a flat rate shipping class; we are going to say that it costs $10 to ship.  Then, after we experiment with that,
  • we are going to create free shipping, for products that are within Colorado. So we'll just go and change the rules, and we'll have free shipping within Colorado, and $10 shipping outside Colorado. So lets' give that a shot.


First of all go and enable the modules. So we will go over and enable the modules here [from modules>list he uses a filter to find "shipping" and "flat rate" which are installed as part of the Kickstart distribution he's using]. OK. Well. I'd already enabled them, but those are the ones that you want, and you'll find them under Commerce (Shipping) [picking from a grey-backed column on the left side of a page] you'll want Flat Rate, Shipping, and Shipping UI. [Shipping User Interface]

Later on, in another podcast in another screencast, I will show you how to do UPS [United Parcel Service] and in a further screen cast we'll do some more complicated rules like "free shipping over $100" - that kind of thing. 

But in this one, we're just going to do two shipping rates, one for within Colorado and one for outside Colorado.  We'll give that a shot and see if we can make that work.

So the first thing we're going to do is: we'll go-over to Store>Configuration>Shipping, and we're going to take a look at what we have here: We have [three tabs] -

| Shipping Methods | Shipping Services | Calculation Rules |

All we are going to do today is we're going to look at | Shipping Methods |, which is just there [the visible tab] by default: Flat Rate [method] is what we've got [by default], and | Shipping Services |. We can have one or more Flat Rate Shipping Services. You could think of them as "shipping instances", or whatever you want to call them.
[3'10"]
I'm going to say "add a flat rate service", [does so] and I'm going to say... I am going to call it "Flat Rate", and it's going to be $10. And now we have a new shipping service, under the tab

| Shipping Methods| Shipping Services | Calculation Rules |

Display Title: flat rate... ... ... ...  so this is all set-up. It will automatically be available as a shipping method for any purchase that we make. So let's go ahead and make a purchase.  We'll buy "product three" - how about that! Checkout.  And [add] shipping information.-I'm going to be in Palisade Colorado. Fill this in here. Continue-on.  We see that we are offered Flat Rate Shipping. That is the only service that we have to find.  And we go for it. So, here we are [at the "review your order" screen] - it's done exactly as we asked: it has added flat-rate shipping $10 on to our charge.  and... I've got no payment required. I've got free payment. That's not something you'd want on any site but I can have free payment on this one!

OK - so, Now.
I want $10 shipping in the rest of the USA but in Colorado I want just free shipping.  So there is
What we need to do is create another "free shipping" type. We're going to Store>Configuration>Shipping, and we're going to add another flat-rate service. We'll call it "free shipping inside Colorado".  [copies text for display title. leaves description blank]. And... price is zero.  [presses "save"] And now we have another service: it's called "free shipping inside Colerado"

What we need to do now is remember that this is a Rules component [of the Rules module].  Every rule has an 
  • event, a 
  • condition [or condions] and an 
  • action.  [points to the Conditions and Actions sections of the screen].  
Events are what a rule listens to, conditions decide whether it takes the action, and actions which are things that we are going to do. We are already listening for the "rate shipping" event, and we are going to say "should this rule apply to us", in other words "should we select free shipping"

[5'19"]

...so I'm going to add a condition [from a long drop-down menu including "Commerce Order" as a subheading in bold], and it's going to be a Commerce Order address component comparison. So there we go. The value that I want to compare against: the address that I want to use is the shipping address.. The address component that I want to compare is, first of all, I want to compare the Country. I'll make sure we get the country in there. Otherwise, there might be a "CO" abbreviation in some other country. By the way, this is the two-character country code for the country that I was talking about.  So we have a condition for that.  Now we are going to add one for the State. We're going to do the exact same thing again - Add a new condition> ORDER>Data selector> commerce_order

It's the shipping address that we want... [on the same page further down]
ADDRESS COMPONENT>Value>Administrative area (State / Province).
VALUE>Value
The two-letter code for Colerado is CO.
Save.

So now we have - er - two conditions on there [in the Conditions ELEMENTS box] One is:
Is the country US? The other is
Is the state Colerado?
Then we're going to add that there [in the Actions ELEMENTS box below].

So now we are going to go back and fix the other one so that we don't offer free shipping.
So let's go ahead and do that: we're not going to offer free shipping anytime that they are not shipping to Colerado. So: Store>Configuration>Shipping>ShippingServices 
And now we have to edit the flat rate - and this we don't want to offer if they are outside Colerado.

So let's just say that we only want to offer shipping in the US, because that's [  ] a separate thing.  So lets just go ahead and say [on Add a new condition] ORDER>Data selector ...
and the value of the administrative area [options are = / not =  / contains] lets say "equals" CO. And then we're going to say [with a tick box just above the save button at the bottom of the page] "Negate":  [9'30"] This does not contain Colerado so don't do it. Save.

Lets go ahead and add the other condition, about the US.
Add a new condition > Select the condition to add > drop down menu
Commerce Cart > ?
...just in case there is some other sort of thing [that has a CO abbreviation]. We'd probably take care of this another way, by offering a different shipping [service] outside the US, [which would] just tell them that we couldn't do it.
DATA SELECTOR > Country >
OPERATOR > equals
...just for now I am going to say "equals US"
We are going to say that this [flat rate shipping rule] applies to shipping that is in the US, but is outside Colerado.
[...]

And so now lets go-see if that works: [10'35"]
...you'll see that it already thinks that I'm in Colorado. No - it just doesn't know yet. It didn't ahve any information. Now we know. Now lets try again. Lets try shifting the state to Kentucky. ...and now it's offering only the flat rate $10 ammount. So now it's doing what we told it to do. The first time we tried this, we didn't have a way to choose [where we are] at the checkout.

...Colerado: then we get free shipping.


Let's just take a look at what we've done. First of all we've used
Commerce_Shipping [module] 2.X . We've used
Commerce_Flat_Rate - (
not the older (what do you call it?)... not the older Commerce_Shipping_Flat_Rate, which is basically depricated now.
Using those two, we have gone-in to Drupal admin (with Drupal Commerce enabled and a Store menu on admin).
  • We have gone into Admin>Store>Configuration>Shipping
  • We have a flat rate SHIPPING METHOD.
  • We hae added two services. Let's take a look at the two services we added. The two services are
  • Flat Rate (Machine name flat_rate), which is the $10 one, and
  • free Shipping inside Colorado (Machine name free_shipping_inside_colerado), which would be $0.
  • And then we added a Rules component to make sure that they were chosen at the right time. So free shipping is chosen if we are shipping to the US, and we are shipping to Colerado.
  • And we did the opposite on the other one.
So that's the basics! That's the first and easiest configuration of flat rate shipping .
I will do a couple more screen casts. I'll do one on Commerce_UPS, which is now working, and I'll also do one on fancy rules. So, thanks for listening, and see you in the issue queue and everywhere else! Thanks - bye bye.



.

1 comment:

  1. Hi.....
    Shipping is not showing on the 'Shipping' page of the checkout process. I have set the shipping service up exactly as Randy Fay instructed in his video, very carefully checked it all, but I cannot get shipping options to show on the 'Shipping' page of the checkout process.
    you can get the more information then click here Gmail Telefoonnummer Nederland

    ReplyDelete