Free Shipping - Shipping Method - One Built Yet?

Issue #55 closed
Jeffrey Olmstead
created an issue

I have a client that wants to provide free shipping (in the USA) if the value of the order is a certain amount (i.e. if order total is $100). I don't believe there is an existing module for this yet but inquiring to see if anyone knows of one. Thanks for letting me know.

Comments (6)

  1. Jeffrey Olmstead reporter

    I have mimicked Size-Based shipping / Weight-Based shipping. Along that line, there is an issue in Weight-Based shipping (i.e. WeightBasedShippingMethodPart.cs) on line 67 it appears it should be this:

    else if ((weight >= MinimumWeight || MinimumWeight == null) && (weight <= MaximumWeight || MaximumWeight == null)) {
         yield return GetOption(fixedCost + Price);

    Since both MinimumWeight and MaximumWeight are nullable, need to handle the nulls in the check.

    Other than that, there seems to be a problem in both Size-Based shipping and Weight-Based shipping in that, no matter what "Areas for which this method is valid" or "Areas for which this method is not valid" you select, the shipping method is always applied (i.e. the underlying "IncludedShippingAreas" and "ExcludedShippingAreas" are not used as a filter mechanism to exclude the shipping method).

    Can you confirm the above problem exists on your end? Is this what is expected of the included / excluded shipping areas? It seems that there should be a filter applied right in the ShippingService on line 27 to only include methods for where the user country / zip code is in and to exclude methods for where the user country / zip code is not in.

    Of course, this is complicated because the "CoreShippingAreas.cs" file only provides an ID / Name so only it would be able to tell from a given country / zip code whether or not the condition was met. If I am on the right track, could we extend IShippingAreaProvider with a method like:

    bool IsInArea(string areaId, string zipCode, string country);

    The expectation would be that each IShippingAreaProvider handles it's own area condition and provides confirmation whether a given zipCode and/or country exists within a given areaId.

    Hope this makes sense and look forward to your thoughts.

  2. Bertrand Le Roy repo owner

    Yes, the included and excluded areas a a remnant of the Google Checkout era. Services such as USPS work completely differently, by inferring the applicability of shipping methods from the zip code and country. This is why no code is in place to make it work: it was the responsibility of the credit card gateway to select among the shipping methods provided. I would simplify all that and get rid of the notion, especially for a free shipping option: you should be able to get away with a simple "international" Boolean. Good catch about the nullables.

  3. Jeffrey Olmstead reporter

    Ok, I can agree that it makes sense to move away from the included and excluded areas in general, though I still love the ability to control shipping methods by country / state. For example, if someone in Europe utilizes this Free Shipping feature, checking "International" won't help them any as I would have set "International" up to be anything that is not United States. For this reason I have set up my Feature to allow the selection of:

    Included Countries

    Excluded Countries

    Included States - Applies to United States Only

    Excluded States - Applied to United States Only

    This way, they are in full control of what regions of the world their shipping method targets. I can see this would be valuable on the Size Based and Weight Based shipping methods, in fact, I have a client who may absolutely need this level of control so they can set up different Size Based shipping rates based on countries of the world it is going to.

    Of course, what would be really phenomenal is if someone (not me right now) in the future would build a regions of the world taxonomy that would allow for the selection of things like "North America", "Western Europe", etc. I had to do this with a company I worked with in the past on their CRM application. The problem is that there are debates over some countries so it does get messy. I digress, but if someone reads this and wanted to tackle it, that would be a nicer way of selecting regions of the world.

    Let me know what you think about updating the Size Based and Weight Based methods to handle Included Countries, Excluded Countries, Included States, Excluded States. Then I think the "CoreShippingAreas.cs" and "IShippingAreaProvider" could be pulled out completely as well as the "IncludedShippingAreas" and "ExcludedShippingAreas" columns. Look forward to your thoughts.

  4. Bertrand Le Roy repo owner

    Yes, lists of countries are tricky, which is why the USPS shipping code is leaving that to USPS :)

    Please feel free to improve the size and weight methods. I don't think they are very useful currently, except as a base to build something more realistic.

  5. Log in to comment