Blog posts tagged with 'FreeShipping'

RSS
Example - Free ground shipping for Coupon Code, but want the customer to still have the option to pick the quicker options from Fedex at the regular price.- Monday, June 16, 2014

You can get the customer entered Coupon Code using:  Customer.GetAttribute("DiscountCouponCode").   In an Option record's surcharge expression, use the built-in [$Name] variable to get the carrier's shipping method name and the built in [$Rate] variable to get the method's rate.  In Surcharge Expression negate the rate if the shipping option name contains the word “Ground”.

Add new 'Shipping Director' record - a variable to get the customer entered coupon code.  Use ' + "." ' at the end because when the customer does not enter a code, then [DiscountCouponCode] will be null, so we need to check that before applying ToLower() below, or easier is just to append the ".". *

Type

String

Name

DiscountCouponCode

Expression

Customer.GetAttribute("DiscountCouponCode") + "."

Add new 'Shipping Director' record - a variable to calculate when free ground.  For example, if the Coupon Code is "freeground." (with "." at the end):

Type

Boolean

Name

FreeGround

Expression

[DiscountCouponCode].ToLower() = "freeground."



Add new 'Shipping Director' record - an Option record to get the rate.  Use a negative surcharge.

Type

Option

Name

FedEx Free ground shipping with Coupon

Expression

true

Rate Expression

Shipping.FedEx

Surcharge Expression

[FreeGround] and [$Name].Contains("Ground") ? -[$Rate] : 0

Name Expression

[FreeGround] and [$Name].Contains("Ground") ? "Free Ground Shipping" : [$Name]

Description Expression

 



If you have many different coupon codes, then give them something common so that you can easily detect them.   For example, if you have codes "ground1", "ground2", etc., then the variable's expression could be [DiscountCouponCode].ToLower().StartsWith("ground").  Or, you could use ... .Contains("ground").   

(*We could have used ' + "" ' (empty string) above rather than ".", but all strings contain and start with the empty string)

(update 7/26/2014:

For 2.65, replace    

   Customer.GetAttribute("DiscountCouponCode")

with just
      Customer.DiscountCouponCode 

Tags :  FreeShipping
Comments (5)
Simple Free Shipping based on Role- Tuesday, December 18, 2012

Here's a very simple free shipping scenario with fixed rates.  Customers in the "Free Shipping" role get an option for free shipping ($0).  If not in that role, they see regular shipping.  (The leading "!" is the NOT operator.)   Everybody sees an option for "Fast Shipping".  

Order

Type

Name

Expression

Rate Expression

10

Option

Free Shipping

Customer.CustomerRoles.Any(Name = "Free Shipping")

0

20

Option

Regular Shipping

!Customer.CustomerRoles.Any(Name = "Free Shipping")

5

30

Option

Fast Shipping

true

10

 

So, if the customer is in the Free Shipping role, then she sees

Select shipping method
 Free Shipping ($0.00)
 Fast Shipping ($10.00)

And if she's not in that role she sees

Select shipping method
 Regular Shipping ($5.00)
 Fast Shipping ($10.00)

 

You can always add additional criteria.   If there are a lot of criteria, then create a variable to make it easier to read and maintain.  For example, let's also have additional criteria that the cart subtotal must be greater than $250

Order

Type

Name

Expression

Rate Expression

5

Boolean

HasFreeShipping

Customer.CustomerRoles.Any(Name = "Free Shipping") and [$SubTotalWithDiscounts] > 250

 

10

Option

Free Shipping

[HasFreeShipping]

0

20

Option

Regular Shipping

![HasFreeShipping]

5

30

Option

Fast Shipping

true

10

 


Tags :  FreeShipping
Comments (0)
$5 Ground for orders over $50 except Alaska & Hawaii- Sunday, December 9, 2012

Another simple example of having a reduced Ground shipping rate

Basically, you use the Surcharge to negate the Ground Rate and then add $5.   In this example, we do it for USPS.  (Read more about using Surcharge to adjust the rate here)

Order

Type

Name

Expression

Rate Expression

Surcharge Expression

100

Packing

Pack

true

Packing.FirstFitSingleBox

 

110

Option

USPS

true

Shipping.USPS

([$SubTotalWithDiscounts] > 50) AND !("AK,HI".Contains([State]) AND [$Name].Contains("Ground")) ? -[$Rate] + 5 : 0

For the most accurate carrier rates, set your package size - see this blog about packing 

Tags :  FreeShipping
Comments (0)
Free Shipping over ‘X’ but still charge “Additional Shipping Charges”- Friday, December 7, 2012

If you want to use Free Shipping over ‘X’ but still charge “Additional Shipping Charges”, you can't use nopC’s built-in Admin > Configuration > Settings > Shipping >> "Free Shipping over 'X'" because it will ignore Additional Shipping Charges set on product variants.  The built-in Free Shipping over ‘X’ is always calculated last after shipping plugins return their options.   You can make this work with Shipping Director.  First, be sure to turn off "Free Shipping over 'X' " in admin.  (And as always when using SD, be sure that SD is the only Active rate calc method.)

This is really easy to do in SD – just calculate a 0 rate when the subtotal is over X!  Then, NopC will always add the additional shipping charges.  For example, here’s free shipping ($0) if the subtotal is more than $50:

Order

Type

Name

Expression

Rate Expression

10

OptionExit

Shipping

[$SubTotalWithDiscounts] >= 50

0

 

Of course, to make this complete, we'll add the second Option record to provide the rate if the cart does not meet the minimum amount.  And, to get a little fancy, we’ll use the Name Expression to show the customer “Free Shipping” if none of the items have any additional shipping charges, otherwise show “Shipping”:

Order

Type

Name

Expression

Rate Expression

Name Expression

10

OptionExit

Shipping

[$SubTotalWithDiscounts] >= 50

0

Items.Any(Product.AdditionalShippingCharge > 0) ? "Shipping" : "Free Shipping"

20

Option

Shipping

true

5

 

The second record above is a flat $5 rate, but you can of course use any type and number of additional methods/rates instead.

(P.S.  updated on July 2014 - ProductVariant -> Product)

Tags :  FreeShipping
Comments (0)
More Complex Free Shipping Scenario- Monday, April 23, 2012

This is a more complex free shipping scenario that involves multiple free shipping methods (Fedex Ground & Standard), and also a "$5 Next Day Shipping".  So, some items can get Free Ground, other items can get Free Next Day, and other items can get $5 Next Day.  I won't go into too much detail about how this one works, so you should read the prior blog to understand the idea of packing for free shipping, and the multiple Option type records.  I know it looks a little daunting.  In the future I hope to provide a simpler interface, or the nopCommerce core will support product level shipping configuration.

Similar to last blog, separate Categories are used to pidgeonhole the products.  Note the Reference variable hasReducedNextDayShipping;  this covers both free next day and $5 next day.   The Fedex Name for standard next day is "FedEx Standard Overnight".   The idea is to first use Option(FedEx) to get the rates for all the products, then Pack/OptionReplace to get (replace) the rates for non-reduced items.  Finally, add in rate for $5 Next day items.

Note the new Packing method "Packing.ClearPackages".  This restores the original "single package" which is the default state prior to any other packing methods being used.  This is necessary because the Option record type with a  Rate Expression that is not a shipping method like Shipping.Fedex applies the Rate Expression for each package; we just want one package because we calculate variable "Number of $5 NextDay Items" based on sum of item quantities.  Then the last Option type record adds the appropriate number of $5 per item charges to the "FedEx Standard Overnight" rate (after it's been previously calculated by Fedex for the non-reduced next day items if any).

EvalType

Name

Expression

RateExpression

NameExpression

DescriptionExpression

Reference

HasCategory

ProductVariant.Product.ProductCategories.Any

 

 

 

Reference

hasReducedGroundShipping

[@HasCategory]
(Category.Name.Contains("Ground Shipping"))

 

 

 

Reference

hasReducedNextDayShipping

[@HasCategory]
(Category.Name.Contains("Next Day Shipping"))

 

 

 

Reference

has5$NextDayShipping

[@HasCategory]
(Category.Name = "$5 Next Day Shipping")

 

 

 

Integer

Number of $5 NextDay Items

Items.Where
([@has5$NextDayShipping]).Sum(Quantity)

 

 

 

Option

FedEx All Items

true

Shipping.Fedex

 

 

Packing

Pack exclude reduced-ground items

Items.Any([@hasReducedGroundShipping])

Packing.FirstFitSingleBox

 

[@hasReducedGroundShipping]

OptionReplace

FedEx Ground Only

Items.Any([@hasReducedGroundShipping])

Shipping.Fedex

[$Name].Contains("Ground")
 ? [$Name] : ""

 

Packing

Pack exclude
reduced-nextday items

Items.Any([@hasReducedNextDayShipping])

Packing.FirstFitSingleBox


[@hasReducedNextDayShipping]

OptionReplace

FedEx NextDay Only

Items.Any([@hasReducedNextDayShipping])

Shipping.Fedex

[$Name].Contains("Standard")
 ? [$Name] : ""

 

Packing

Clear Packages For Fixed Rates

true

Packing.ClearPackages

 

 

Option

$5 NextDay

Items.Any([@has5$NextDayShipping])

[Number of $5 NextDay Items] * 5.00

"FedEx Standard Overnight"

 

Tags :  FreeShipping
Comments (2)
Packing removes Free Shipping items- Monday, April 23, 2012

When configuring a product variant you can select "Free Shipping:".   However, there are a few caveats you should know.

1) If ALL the items in the cart are marked Free Shipping, then the shipping charge will be $0 regardless of any shipping method or configuration (country/weight, etc).  Even Shipping Director cannot override this, as it is calculated in the core system.

2) Free Shipping is currently not respected by online rate methods (FedEx, UPS, USPS, etc.).  It is respected by the offline methods ByTotal, and ByWeight.  And, it's also respected by Shipping Director's Packing.

By "respected", I mean that all the product items will be counted in the weight/dimensions.  To get an accurate rate, you need to only get a rate based on the weight/dimensions of the non-free-shipping items.

So, a simple setup to use the product variant Free Shipping with an online method looks like this

Type

Name

Expression

Rate Expression

Packing

Pack ignores items marked FreeShipping

true

Packing.FirstFitSingleBox

OptionExit

FedEx only sees packed items

true

Shipping.Fedex

However, the above will (for items that are not free shipping) calculate rates  for ALL the shipping methods - Ground, Priority, Standard, etc.

If you want to only offer Free Ground Shipping then it is necessary to first get a rate quote for all items, and then get a rate quote for just the non-free-shipping items for just the Ground method.  But, as pointed out above, if ALL items are marked Free Shipping in the product variant, then we always get a $0 rate.  So, we can't use the Free Shipping checkbox on the variant.  Instead, I recommend using a Category.  Set up a "Free Ground Shipping" Category, and mark it as unpublished (i.e. uncheck "Published" check box).  If the category is unpublished, you can still put products in the category, but it won't appear in the category navigation tree or elsewhere.   (If you need free ground on only a specific variant of a product, then you'll have to use some other mechanism; we won't cover that here.)

To get Ground only rates, we need to exclude certain methods (e.g. Priority, Standard).  For that we need to use the Option record type's ability to modify the shipping method Name returned by the offline shipping method; if the Name Expression evaluates to blank (""), then the entire method/rate is excluded.    Also, we need to replace the the first Ground rate calculated on all the product items.  For that, we use the new OptionReplace type.  The "Option" type adds rates to existing same-Name methods, whereas "OptionReplace" will replace the rate.

So, assuming we are not using product variant Free Shipping and instead using Categories, it looks like this - Get rates for all methods, pack only the non-Free Shipping items (by excluding Free-Shipping items), get the rates again but only keep the Ground rate replacing the original Ground rate.

EvalType

Name

Expression

Rate Expression

Name Expression

Description Expression
(Exclude)

Reference

hasFreeGroundShipping

Product.HasCategory("Free Ground Shipping")

 

 

 

Option

FedEx All Items

true

Shipping.Fedex

 

 

Packing

Pack exclude free-ground items

Items.Any([@hasFreeGroundShipping])

Packing.FirstFitSingleBox

 

[@hasFreeGroundShipping]

OptionReplace

FedEx Ground Only

Items.Any([@hasFreeGroundShipping])

Shipping.Fedex

[$Name].Contains("Ground")
? [$Name] : ""

 

Don't forget, you can use the $Debug variable as your first record, and this will provide detailed processing messages in the System Log (view source of page for readability).

EvalType

Name

Expression

Boolean

$Debug

true


(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 – it had two References rather than one:

EvalType

Name

Expression

Reference

HasCategory

ProductVariant.Product.ProductCategories.Any

Reference

hasFreeGroundShipping

[@HasCategory](Category.Name =
 "Free Ground Shipping")


Tags :  PackingFreeShipping
Comments (0)
Example - Free ground shipping on orders over $50, but want the customer to still have the option to pick the quicker options from Fedex at the regular price.- Friday, February 3, 2012

Use the Surcharge Expression to negate the rate if the shipping option name contains the word “Ground”.

Add new 'Shipping Director' record

Type

Option

Name

FedEx Free ground shipping only on orders over X

Expression

true

Rate Expression

Shipping.FedEx

Surcharge Expression

[$SubTotalWithDiscounts] > 50 and [$Name].Contains("Ground") ? -[$Rate] : 0

Name Expression

[$SubTotalWithDiscounts] > 50 and [$Name].Contains("Ground") ? "Free Ground Shipping" : [$Name]

Description Expression

 



Tags :  FreeShipping
Comments (5)