Blog posts of '2012' 'August'

RSS
Restricted Products Can’t Ship to Outside of Certain Countries.- Tuesday, August 7, 2012

In this scenario, our requirement is to prevent shipping certain products to countries outside of the European Union (EU 27).  Similar to the last blog, you should set up an unpublished category for the restricted products.  Then, in SD, we check if both the shipping address is outside the permitted countries and the cart contains restricted products.  If this condition occurs, the ErrorExit line will cause the message "Sorry, we can't ship restricted products outside the EU" to appear to the customer, and prevent them from checking out. (The double quotes are required because Description Expression is an expression) 

Order

Type

Name

Expression

Description Expression

30

String

EU_27

"AT,BE,BG,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IE,IT,LV,LT,

LU,MT,NL,PL,PT,RO,SK,SI,ES,SE,GB,"

 

40

Boolean

IsRestrictedCountry

![EU_27].Contains(ShippingAddress.Country.TwoLetterIsoCode)

 

50

ErrorExit

 Restricted Products

[IsRestrictedCountry] and Items.Any(Product.HasCategory("Restricted Shipping"))

"Sorry, we can't ship restricted products outside the EU"

60

Option

 

 

 

  Order Line 60 would be whatever Option(s) you would want to offer.

(The above blog was updated 9/8/2013.  Older versions of Shipping Director did not have HasCategory() function, and used a more complex expression to get the Category:

Order

Type

Name

Expression

Description Expression

10

Reference

categories

 ProductVariant.Product.ProductCategories

 

20

Reference

categoriesAny_Restricted

 [@categories].Any(Category.Name = "Restricted Shipping")

 

30

String

EU_27

"AT,BE,BG,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IE,IT,LV,LT,

LU,MT,NL,PL,PT,RO,SK,SI,ES,SE,GB,"

 

40

Boolean

IsRestrictedCountry

![EU_27].Contains(ShippingAddress.Country.TwoLetterIsoCode)

 

50

ErrorExit

 Restricted Products

 [IsRestrictedCountry] and Items.Any([@categoriesAny_Restricted])

"Sorry, we can't ship restricted products outside the EU"

60

Option

 

 

 


Tags :  Restricted
Comments (1)
Next Day Shipping Rate depends on if any or all items are eligible for it.- Thursday, August 2, 2012

In this scenario, our requirement is to offer Standard Shipping and Next Day Shipping methods with fixed amount for each: £3 for Standard and £10 for Next Day).  However, only certain products can be sent on Next Day delivery.  We need the checkout process to exclude Next Day if not applicable.   Additionally, if the cart has a mix of products, some that allow Next Day and some that don't, we want to charge BOTH the Standard and Next Day delivery charge combined on the order (£3 + £10 = £13).

So, we always want to offer Standard shipping at £3, and then additionally offer Next Day if the cart has any Next Day eligible products – but if the cart has a mix, then since we need to ship out two deliveries, we want to charge for both.  Here are the possible cases:

No Next Day eligible products:

Standard              £3

All Next Day eligible products:

Standard              £3

Next Day             £10

Some Next Day eligible products, and some not:

Standard              £3

Next Day             £13

And here’s one way to do it in Shipping Director:

Create a (non-published) Category called “Can Ship Next Day”, and put all eligible products in that category.   (Remember, products can be in more than one category).  Then, just configure Shipping Director! 

Order

Type

Name

Expression

Rate Expression

10

Reference

canShipNextDay

Product.HasCategory("Can Ship Next Day")

 

30

Option

Standard

true

3

40

OptionExit

Next Day

Items.All([@canShipNextDay])

10

50

OptionExit

Next Day

Items.Any([@canShipNextDay])

13

 

(The above blog was updated 9/8/2013.  Older versions of Shipping Director did not have HasCategory() function, and used a more complex expression to get the Category: 

Order

Type

Name

Expression

Rate Expression

10

Reference

categories

ProductVariant.Product.ProductCategories

 

20

Reference

categoriesAny_CanShipNextDay

[@categories].Any(Category.Name = "Can Ship Next Day")

 

30

Option

Standard

true

3

40

OptionExit

Next Day

Items.All([@categoriesAny_CanShipNextDay])

10

50

OptionExit

Next Day

Items.Any([@categoriesAny_CanShipNextDay])

13



Tags :  VariableRate
Comments (0)