The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Shipping options for each product

jwghcjwghc Member
in General edited March 2012
(We are using Foxyshop/Foxycart)

We have certain products that we want to specify can only be shipped with UPS and others that can be shipped with USPS flat rate. However, if we give them option to choose from all available options in foxycart then they may choose the cheaper option or incorrect shipping method. Some products require smaller or larger packaging so including all options wouldn't be right.

Example:
Product 1 must be shipped UPS 2 day air with an insulated box. But Product 2 can be shipped using USPS medium flat rate box. But why not give Product 2 the option to be shipped with UPS if they want to pay for faster service? However we wouldn't want the customer to choose the wrong option.


What is the best/easiest way to customize this as an option? Do I do this in product categories? What are all my options?
I hope this makes sense.
Comments
  • sparkwebsparkweb Member, Integration Developer, FoxyShop, Order Desk
    I'd setup a flat rate shipping category that is $x per product or per order. Then for the flat rate things, assign them to that shipping catgory. Everything in the default category can go with live rates. Since it's a flat rate it would be much easier to implement it that way.
  • jwghcjwghc Member
    Thank you for the reply.

    If I use this option, what happens when more than one product is ordered at a time? If it is flat rate per product i can understand it adds the total.... but if it is flat rate per order, how is it calculated when they have multiple items in one order?
  • jwghcjwghc Member
    I also have some items that are perishable and some that aren't. How does that get handled as well if they are bought together in an order?

    Thanks in advance
  • lancelance Member, Community Support Member
    @jwghc -

    The solution that sparkweb provides will allow you to define very specific rules based on the category of each product. So perishable products could all be in a "perishable" category and shipped using a flat rate per item or per order. Non-perishables could use live rates or you could elect to setup totally separate flat rates for those, too. Essentially, everything comes down to categories in this particular case.

    There are other options for far more complex shipping integrations, but if you can make this work, I would recommend it.

    Lance
  • jwghcjwghc Member
    @lance thanks for the comment. how does the cart handle it when there is an order for both types of items in the same order?
  • lancelance Member, Community Support Member
    @jwghc -

    All category rules will be applied as appropriate and summed together for shipping. Are you planning to mix live and flat rates?

    If you plan to use live rates for both perishable and non-perishable products you may need to apply some custom JS to hide certain shipping options at certain times. If you can provide the particular setup you are considering, I'm happy to suggest a reasonable solution for you.

    Lance
  • jwghcjwghc Member
    @lance thank you for the help and offer. I will let you know if we choose to go that route. sounds like flat rates may be easiest.
  • jwghcjwghc Member
    @lance and @sparkweb

    1) After looking at the options this seems much more complex to me than I had hoped. I would like the perishable goods to only go UPS 2day (because of insulated packaging) and have the other options not appear in checkout.

    2) What do I do for international shipping? I can't allow someone internationally to choose a shipping option that wouldn't suffice.


    3) Will there ever be an option to customize shipping for each product category? This is especially needed for people that don't know JS.

    Suggestions?
  • lancelance Member, Community Support Member
    @jwghc -

    Especially since you said that you think you can get by with flat rates, you might want to take a look at the multiple flat rates snippet to see if you can make it work for you.

    http://wiki.foxycart.com/snippets/shipping/multiple_flat_rates

    It will require a little bit of JavaScript, but it shouldn't demand an expert level of skill. This will allow you to set flat rates by category and you can even adjust them for international destinations. Steps 1-3 you can just follow the directions, and the only place you'll need to write any JS of your own is in steps 4 & 5. The examples given, though, should help you out.

    This snippet might very well get you where you need to be for the time being, so take a look and let me know if you think it has potential.

    As to your third question, the next major release of FC is likely to expected to have a major shipping overhaul, but neither the specifics about the overhaul nor a planned release date have been announced. Rest assured, though, that shipping is a huge PIA in almost every e-commerce solution out there, so it isn't a challenge unique to FoxyCart.

    Lance
  • fc_adamfc_adam FoxyCart Team
    @jwghc,

    Something that might be worth clarifying, are you looking to use live rates as returned from USPS based on the shipping address or do you have a list of flat rates that apply to your shipping options and you just need a way to refine them to certain situations?
  • jwghcjwghc Member
    @fc_adam we would have used live rates based on shipping address. I think we may have to use @lance's recommendation for now so we can get going.

    @lance thank you for your reply.
  • fc_adamfc_adam FoxyCart Team
    @jwghc,

    If you're going to use live shipping rates, it's actually not that hard to code up to only show certain shipping options based on what's in the cart. Essentially you'd just need to know two things - what denotes that a product is perishable (are they all in certain categories, have certain codes etc) and what are the shipping options that perishable items can be shipped with. Once you have that, it's not too involved to get the rest sorted.

    If you'd like a hand setting this up, if you could answer those two questions it should be a fairly quick process.
  • jwghcjwghc Member
    @fc_adam I would love a hand setting that up.

    I will lay out what my product/shipping situation is. From there you can let me know what is possible.

    - I have 4 products that are perishable that must be shipped UPS 2day air. I have them in a product category "perishable".

    - I have other products that need to be shipped UPS (no specific time) in a "UPS only" category.

    - I have other products that can ship USPS flat rate in 2 categories: "Flat Rate Medium" and "Flat Rate Small".

    Another question is how does the cart work live rates and flat rates in the same order?

    I REALLY appreciate your help. Let me know if you need to take this offline to get specific info.
  • fc_adamfc_adam FoxyCart Team
    @jwghc,

    I'll get back to you on Monday with a script you'll be able to use, but to answer your question - if the cart has a flat rate based product, when the live rates are requested, any flat rate fees are added into those rates, so the customer will be able to select a rate that includes both the live shipping rate and your flat rate. Does that make sense?
  • jwghcjwghc Member
    @fc_adam i appreciate this!

    I needed to add a couple categories because a few products are non tax items. Will this affect the process?

    That does make sense about the shipping rates including both live and flat. There are so many potential scenarios that I'm sure I will have more questions.

  • fc_adamfc_adam FoxyCart Team
    edited April 2012
    @jwghc,

    First off, follow the steps described on this page: http://wiki.foxycart.com/snippets/shipping/live_rate_shipping_modification

    For the custom logic, use this:
    var perishable = false;
    var ups_only = false;
    for (p in fc_json.products) {
      switch (fc_json.products[p].category) {
        case "perishable":
          perishable = true;
          break;
        case "ups_only":
          ups_only = true;
          break;
      }
    }
    
    // Hide all of the options so we can just show what we want to show
    FC.customLiveShipping.hide('all');
    
    if (perishable) {
      FC.customLiveShipping.show("UPS 2 day");
    } else if (ups_only) {
      FC.customLiveShipping.show("UPS");
    } else {
      FC.customLiveShipping.show("USPS flat rate");
    }
    

    So basically this script goes in this order:
    If there are products in the perishable category, only the UPS 2 day rate is available. If not, and there are products in the UPS Only category, then only UPS options are provided. If no perishable or ups only categories are present, then USPS flat rate options are shown. Note that the corresponding rates need to be selected in your shipping options. I've also assumed that you're UPS Only category has a code of "ups_only". You'll need to change it in the script if this is not the case.

    Also worth noting the live rate shipping modification script was only developed over the weekend, so it's still pretty new. Make sure you test thoroughly to make sure it's working as you expect.
  • jwghcjwghc Member
    @fc_adam thank you! I will be sure to report back.

    I really appreciate it!
  • jwghcjwghc Member
    @fc_adam and team-

    I have followed step 1 and 2. Before adding the custom logic inside FC.customLiveShipping.logic I added some console.log statement to ensure the function is actually called when the document loads:
    <script type="text/javascript" charset="utf-8">
     //<![CDATA[
     /* Live Rate Shipping Modification Logic v1 */
    
    console.log("Before document ready");
    
     jQuery(document).ready(function() {
       
    console.log("Inside document ready");
    
    jQuery("#fc_shipping_methods_inner").ajaxComplete(function(event, request, settings) {
         if (settings.url.indexOf('GetShippingCost') != -1 && !jQuery("#fc_shipping_methods_inner
    input[type='radio']:first").data("custom-shipping-logic-applied")) {
           FC.customLiveShipping.logic();
    

    None of the console.log messages display in the console, which let me think the code is never called (therefore the FC.customLiveShipping.logic() is never called) . I did notice on the console an error on a php script:

    checkout.php:364 Uncaught SyntaxError: Unexpected identifier

    I thought this could be the cause but I am not sure. Any idea why the document.ready function is never executed ?

    Thanks
  • jwghcjwghc Member
    @fc_adam ...sorry I fixed the problem from my last post. Something had gotten lost from the cut and paste. i will report back on the the rest.
  • fc_adamfc_adam FoxyCart Team
    @jwghc,

    Glad you got that sorted - definitely let me know how you go!
  • jwghcjwghc Member
    @fc_adam in the end we had to switch our plan because there are far too many variables with offering flat rate along with UPS. We will now only offer UPS live rates and Fed Ex live rates for 2 products. So we will still need the custom logic to block out some options. I will report back so hopefully this can benefit others.
  • jwghcjwghc Member
    I am back to square one with no custom code for the rates yet implemented. However for some reason all checked shipping options aren't showing up. The only options that show up are UPS 2nd day, Fedex overnight, Fedex 2day and customer pickup. Any idea on why it is not pulling other options like UPS ground and Fedex ground?
  • fc_adamfc_adam FoxyCart Team
    @jwghc,

    Which store is this for?
  • jwghcjwghc Member
    edited April 2012
    @fc_adam, PristineHydro is the store. do you need any specific info to find it?
  • fc_adamfc_adam FoxyCart Team
    @jwghc,

    From looking at Fedex's documentation and your shipping settings, I believe (for Fedex at least) the ground option is for business deliveries only. For a general rate for residential you'd want to select Fedex Home.

    Your UPS settings are set to letter, which I believe can't be more than 0.5lb. Try changing that to package instead.
  • jwghcjwghc Member
    @fc_adam thanks!!! it worked!

    now i will need to implement some of that custom code for a couple new options. i will report back. thanks for all your help!
Sign In or Register to comment.