Example - Local Pickups and Local Delivery

Maybe you're a small local store or restaurant, or pizza place; you want to offer local pickup at one of your two locations, or you will deliver nearby.  Here's an example using State, but could also check ShippingAddress.ZipPostalCode or ShippingAddress.City 

 

Order

Active

Type

Name

Expression

Rate Expression

Surcharge Expression

Name Expression

Description Expression

10

 

ErrorExit

No State Entered

ShippingAddress.StateProvince = null

 

 

 

"Please enter Country, State, and Zip"

20

 

ErrorExit

No Zip Entered

ShippingAddress.ZipPostalCode = null

 

 

 

"Please enter Country, State, and Zip"

50

 

String

ShippingState

ShippingAddress.StateProvince.Name

 

 

 

 

100

 

Option

In Store A Pickup

true

0

 

 

 

110

 

Option

In Store B Pickup

true

0

 

 

 

200

 

OptionExit

Local Delvery

[ShippingState] = "local 1"

10

 

 

 

210

 

OptionExit

Local Delivery

[ShippingState] = "local 2"

20

 

 

 

300

 

ErrorExit

Out of Area

 

 

 

 

"Sorry, we can’t deliver to that area"

Also, this example shows fixed Rates, but you can also calculate some percentage of the cost, or fixed rate plus percentage, etc. using

[$SubTotalWithoutDiscounts]

[$SubTotalWithDiscounts]

e.g.   Rate =  5 + ( [$SubTotalWithDiscounts] * 0.05 )

(Note that only US and Canada have StateProvince configured by default in nopCommerce, so adjust/remove the above ErrorExit if needed)


Tags :  LocalPickup
Comments
Leave your comment
:
Guest
Created on: 2/12/2012 5:32 AM
HI

I have a question.
Where does the local 1 come from in this sentence "[ShippingState] = "local 1" "
René
support@nopTools.com
Created on: 2/28/2012 9:55 PM
René
It's just a example, fictitious, state.  You'll want to use one of  state/province names that a customer would be able to select in the dropdown.
jschrader@5percentnutrition.com
Created on: 1/25/2018 12:43 PM
I have been trying to get this to work on y meal order site with ZipPostalCode (around 130) for a couple days now and have been mostly unsuccessful.

Boolean | IsLocalZip | ShippingAddress.ZipPostalCode = "33744" or ShippingAddress.ZipPostalCode = "33707"
Option | [IsLocalZip] and [Meal Count] > 0

this works with up to 125 zips, but errors out for anything more than that. is there a simpler way to write this as either a Boolean or a string for the Boolean?
support@nopTools.com
Created on: 1/25/2018 6:24 PM
@jschrader
You can use "33744,33707,...".Contains(Zip)

However, you may want to also have an ErrorExit that checks that the zip code entered by the customer is at least (if not exact) 5 characters, otherwise they could enter just a "3" and the Contains() would match it - e.g.

ErrorExit   Zip.Length <> 5        "please enter a correct zip code"

(P.S.  Using the shortcut Zip rather than the fully qualified  ShippingAddress.ZipPostalCode  has been around for some time now.  I've just haven't gone back and updated all the older blogs. :)